vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
d5591f
commit 32fddb982fd61b11a2f218a115975a87ab126d43
d5591f
Author: Darren Tucker <dtucker@dtucker.net>
d5591f
Date:   Mon Nov 7 10:39:01 2022 +1100
d5591f
d5591f
    Fix setres*id checks to work with clang-16.
d5591f
    
d5591f
    glibc has the prototypes for setresuid and setresgid behind _GNU_SOURCE,
d5591f
    and clang 16 will error out on implicit function definitions, so add
d5591f
    _GNU_SOURCE and the required headers to the configure checks.  From
d5591f
    sam at @gentoo.org via bz#3497.
d5591f
d5591f
diff --git a/configure.ac b/configure.ac
d5591f
index 4bf758ac..e172540a 100644
d5591f
--- a/configure.ac
d5591f
+++ b/configure.ac
d5591f
@@ -863,7 +863,8 @@ int main(void) { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
d5591f
 	check_for_openpty_ctty_bug=1
d5591f
 	dnl Target SUSv3/POSIX.1-2001 plus BSD specifics.
d5591f
 	dnl _DEFAULT_SOURCE is the new name for _BSD_SOURCE
d5591f
-	CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE"
d5591f
+	dnl _GNU_SOURCE is needed for setres*id prototypes.
d5591f
+	CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_GNU_SOURCE"
d5591f
 	AC_DEFINE([BROKEN_CLOSEFROM], [1], [broken in chroots on older kernels])
d5591f
 	AC_DEFINE([PAM_TTY_KLUDGE], [1],
d5591f
 		[Work around problematic Linux PAM modules handling of PAM_TTY])
d5591f
@@ -2168,8 +2169,9 @@ AC_CHECK_FUNCS([setresuid], [
d5591f
 	AC_MSG_CHECKING([if setresuid seems to work])
d5591f
 	AC_RUN_IFELSE(
d5591f
 		[AC_LANG_PROGRAM([[
d5591f
-#include <stdlib.h>
d5591f
 #include <errno.h>
d5591f
+#include <stdlib.h>
d5591f
+#include <unistd.h>
d5591f
 		]], [[
d5591f
 	errno=0;
d5591f
 	setresuid(0,0,0);
d5591f
@@ -2191,8 +2193,9 @@ AC_CHECK_FUNCS([setresgid], [
d5591f
 	AC_MSG_CHECKING([if setresgid seems to work])
d5591f
 	AC_RUN_IFELSE(
d5591f
 		[AC_LANG_PROGRAM([[
d5591f
-#include <stdlib.h>
d5591f
 #include <errno.h>
d5591f
+#include <stdlib.h>
d5591f
+#include <unistd.h>
d5591f
 		]], [[
d5591f
 	errno=0;
d5591f
 	setresgid(0,0,0);