Skip to content

Commit

Permalink
common: Make issetugid check simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
ueno committed Jun 18, 2019
1 parent bbb7f04 commit 045d754
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
7 changes: 2 additions & 5 deletions common/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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)
Expand Down
16 changes: 1 addition & 15 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit 045d754

Please sign in to comment.