[openssh-commits] [openssh] 07/07: Invert sense of getpgrp test.

git+noreply at mindrot.org git+noreply at mindrot.org
Mon Feb 26 00:15:49 AEDT 2018


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit c7b5a47e3b9db9a0f0198f9c90c705f6307afc2b
Author: Darren Tucker <dtucker at dtucker.net>
Date:   Sun Feb 25 23:55:41 2018 +1100

    Invert sense of getpgrp test.
    
    AC_FUNC_GETPGRP tests if getpgrp(0) works, which it does if it's not
    declared.  Instead, test if the zero-arg version we want to use works.
---
 configure.ac              | 12 ++++++++++--
 openbsd-compat/bsd-misc.c |  2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index f96c70bc..d3deac83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1736,7 +1736,6 @@ AC_CHECK_FUNCS([ \
 	getpeereid \
 	getpeerucred \
 	getpgid \
-	getpgrp \
 	_getpty \
 	getrlimit \
 	getsid \
@@ -2413,7 +2412,16 @@ static void sighandler(int sig) { _exit(1); }
 	)
 fi
 
-AC_FUNC_GETPGRP
+AC_CHECK_FUNCS([getpgrp],[
+	AC_MSG_CHECKING([if getpgrp accepts zero args])
+	AC_COMPILE_IFELSE(
+		[AC_LANG_PROGRAM([[$ac_includes_default]], [[ getpgrp(); ]])],
+		[ AC_MSG_RESULT([yes])
+		  AC_DEFINE([GETPGRP_VOID], [1], [getpgrp takes zero args])],
+		[ AC_MSG_RESULT([no])
+		  AC_DEFINE([GETPGRP_VOID], [0], [getpgrp takes one arg])]
+	)
+])
 
 # Search for OpenSSL
 saved_CPPFLAGS="$CPPFLAGS"
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index a2f75055..f7187daf 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -238,7 +238,7 @@ isblank(int c)
 pid_t
 getpgid(pid_t pid)
 {
-#if defined(HAVE_GETPGRP) && !defined(GETPGRP_VOID)
+#if defined(HAVE_GETPGRP) && !defined(GETPGRP_VOID) && GETPGRP_VOID == 0
 	return getpgrp(pid);
 #elif defined(HAVE_GETPGRP)
 	if (pid == 0)

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list