diff options
author | Daiki Ueno <dueno@redhat.com> | 2019-06-03 11:28:58 +0200 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2019-06-18 14:17:28 +0200 |
commit | 045d7546fc317deefc2d84d524a211ce6ab4869b (patch) | |
tree | 96f9ce1353f08f3a4652e39839f4c01e2636e3db | |
parent | bbb7f046ff430d33267487cb6f8a0e24d2eab832 (diff) |
common: Make issetugid check simpler
-rw-r--r-- | common/compat.c | 7 | ||||
-rw-r--r-- | configure.ac | 16 |
2 files changed, 3 insertions, 20 deletions
diff --git a/common/compat.c b/common/compat.c index 621f03a..8b14658 100644 --- a/common/compat.c +++ b/common/compat.c @@ -40,10 +40,6 @@ */ #define _XOPEN_SOURCE 700 -#if defined(HAVE_ISSETUGID) && defined(__FreeBSD__) -#define __BSD_VISIBLE 1 -#endif - #include "compat.h" #include "debug.h" @@ -819,7 +815,8 @@ getauxval (unsigned long type) extern int __libc_enable_secure; secure = __libc_enable_secure; -#elif defined(HAVE_ISSETUGID) && defined(HAVE_ISSETUGID_OPENBSD) +#elif defined(HAVE_ISSETUGID) && \ + !((defined __APPLE__ && defined __MACH__) || (defined __FREEBSD__)) secure = issetugid (); #elif defined(OS_UNIX) diff --git a/configure.ac b/configure.ac index 318db2b..492288a 100644 --- a/configure.ac +++ b/configure.ac @@ -115,21 +115,7 @@ if test "$os_unix" = "yes"; then AC_CHECK_FUNCS([setenv]) AC_CHECK_FUNCS([getpeereid]) AC_CHECK_FUNCS([getpeerucred]) - - # Check if issetugid() is available and has compatible behavior with OpenBSD - AC_CHECK_FUNCS([issetugid], [ - AC_CACHE_CHECK([whether issetugid() can detect setuid/setgid], - [ac_cv_issetugid_openbsd], - [ac_cv_issetugid_openbsd=no - AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], - [[return issetugid ();]])], - [chmod 02777 ./conftest$EXEEXT; ./conftest$EXEEXT || ac_cv_issetugid_openbsd=yes], - [ac_cv_issetugid_openbsd=no], - [ac_cv_issetugid_openbsd="guessing no"])]) - if test "$ac_cv_issetugid_openbsd" = yes; then - AC_DEFINE([HAVE_ISSETUGID_OPENBSD], [1], [Whether issetugid() has compatible behavior with OpenBSD]) - fi - ]) + AC_CHECK_FUNCS([issetugid]) AC_CACHE_CHECK([for thread-local storage class], [ac_cv_tls_keyword], |