summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2018-02-25 23:55:41 +1100
committerDarren Tucker <dtucker@dtucker.net>2018-02-26 00:14:42 +1100
commitc7b5a47e3b9db9a0f0198f9c90c705f6307afc2b (patch)
treef0b486ac5bb76056b06d55eff3dd37e7d503a697
parentb39593a6de5290650a01adf8699c6460570403c2 (diff)
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.
-rw-r--r--configure.ac12
-rw-r--r--openbsd-compat/bsd-misc.c2
2 files changed, 11 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index f96c70bcd..d3deac832 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1736,7 +1736,6 @@ AC_CHECK_FUNCS([ \
1736 getpeereid \ 1736 getpeereid \
1737 getpeerucred \ 1737 getpeerucred \
1738 getpgid \ 1738 getpgid \
1739 getpgrp \
1740 _getpty \ 1739 _getpty \
1741 getrlimit \ 1740 getrlimit \
1742 getsid \ 1741 getsid \
@@ -2413,7 +2412,16 @@ static void sighandler(int sig) { _exit(1); }
2413 ) 2412 )
2414fi 2413fi
2415 2414
2416AC_FUNC_GETPGRP 2415AC_CHECK_FUNCS([getpgrp],[
2416 AC_MSG_CHECKING([if getpgrp accepts zero args])
2417 AC_COMPILE_IFELSE(
2418 [AC_LANG_PROGRAM([[$ac_includes_default]], [[ getpgrp(); ]])],
2419 [ AC_MSG_RESULT([yes])
2420 AC_DEFINE([GETPGRP_VOID], [1], [getpgrp takes zero args])],
2421 [ AC_MSG_RESULT([no])
2422 AC_DEFINE([GETPGRP_VOID], [0], [getpgrp takes one arg])]
2423 )
2424])
2417 2425
2418# Search for OpenSSL 2426# Search for OpenSSL
2419saved_CPPFLAGS="$CPPFLAGS" 2427saved_CPPFLAGS="$CPPFLAGS"
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index a2f750558..f7187daf8 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -238,7 +238,7 @@ isblank(int c)
238pid_t 238pid_t
239getpgid(pid_t pid) 239getpgid(pid_t pid)
240{ 240{
241#if defined(HAVE_GETPGRP) && !defined(GETPGRP_VOID) 241#if defined(HAVE_GETPGRP) && !defined(GETPGRP_VOID) && GETPGRP_VOID == 0
242 return getpgrp(pid); 242 return getpgrp(pid);
243#elif defined(HAVE_GETPGRP) 243#elif defined(HAVE_GETPGRP)
244 if (pid == 0) 244 if (pid == 0)