]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
Fix setres*id checks to work with clang-16.
authorDarren Tucker <dtucker@dtucker.net>
Sun, 6 Nov 2022 23:39:01 +0000 (10:39 +1100)
committerDarren Tucker <dtucker@dtucker.net>
Sun, 6 Nov 2022 23:39:01 +0000 (10:39 +1100)
glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE,
and clang 16 will error out on implicit function definitions, so add
_GNU_SOURCE and the required headers to the configure checks.  From
sam at @gentoo.org via bz#3497.

configure.ac

index 4bf758ac5a67e94dae6088eb4eb71c8b9d515949..e172540a1298b3204df563ee49c52e043f27c25f 100644 (file)
@@ -863,7 +863,8 @@ int main(void) { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
        check_for_openpty_ctty_bug=1
        dnl Target SUSv3/POSIX.1-2001 plus BSD specifics.
        dnl _DEFAULT_SOURCE is the new name for _BSD_SOURCE
-       CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE"
+       dnl _GNU_SOURCE is needed for setres*id prototypes.
+       CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_GNU_SOURCE"
        AC_DEFINE([BROKEN_CLOSEFROM], [1], [broken in chroots on older kernels])
        AC_DEFINE([PAM_TTY_KLUDGE], [1],
                [Work around problematic Linux PAM modules handling of PAM_TTY])
@@ -2168,8 +2169,9 @@ AC_CHECK_FUNCS([setresuid], [
        AC_MSG_CHECKING([if setresuid seems to work])
        AC_RUN_IFELSE(
                [AC_LANG_PROGRAM([[
-#include <stdlib.h>
 #include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
                ]], [[
        errno=0;
        setresuid(0,0,0);
@@ -2191,8 +2193,9 @@ AC_CHECK_FUNCS([setresgid], [
        AC_MSG_CHECKING([if setresgid seems to work])
        AC_RUN_IFELSE(
                [AC_LANG_PROGRAM([[
-#include <stdlib.h>
 #include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
                ]], [[
        errno=0;
        setresgid(0,0,0);