disable system issetugid on OS X since it is not fork-safe

Noticed while testing similar code for AIX.
ok beck@
This commit is contained in:
Brent Cook 2015-02-16 22:22:29 -06:00
parent adc416e922
commit a859b93ff5
3 changed files with 24 additions and 0 deletions

View File

@ -226,6 +226,11 @@ AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF],
-a "x$HOST_OS" != xnetbsd \
-a "x$ac_cv_func_arc4random_buf" = xyes])
# overrides for issetugid implementations with known issues
AM_CONDITIONAL([HAVE_ISSETUGID],
[test "x$HOST_OS" != xdarwin
-a "x$ac_cv_func_issetugid" = xyes])
AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdarg.h>

View File

@ -103,6 +103,9 @@ endif
if HOST_HPUX
libcompat_la_SOURCES += compat/issetugid_hpux.c
endif
if HOST_DARWIN
libcompat_la_SOURCES += compat/issetugid_osx.c
endif
if HOST_WIN
libcompat_la_SOURCES += compat/issetugid_win.c
endif

View File

@ -0,0 +1,16 @@
/*
* issetugid implementation for OS X
* Public domain
*/
#include <unistd.h>
/*
* OS X has issetugid, but it is not fork-safe as of version 10.10.
* See this Solaris report for test code that fails similarly:
* http://mcarpenter.org/blog/2013/01/15/solaris-issetugid%282%29-bug
*/
int issetugid(void)
{
return 1;
}