[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getgroups: test: =: unary operator expected
From: |
Eric Blake |
Subject: |
Re: getgroups: test: =: unary operator expected |
Date: |
Fri, 24 Oct 2008 05:49:18 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Jim Meyering on 10/22/2008 9:32 AM:
> To autoconf folks, I've attached the obvious patch below,
> and will push it some time tomorrow if no one objects.
>
> * lib/autoconf/functions.m4 (AC_FUNC_GETGROUPS): Always define
> the shell variable, $ac_cv_func_getgroups_works. Otherwise,
> if it set to "yes" in the environment and configure is run on
> a system like mingw that lacks the getgroups function, it would
> mistakenly define HAVE_GETGROUPS. Reported by Simon Josefsson in
> <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/15354>.
Bah. This is broken in autoconf; sorry for not catching it sooner. In
the case where getgroups is available, the fact that
ac_cv_func_getgroups_works is predefined bypasses the attempt to even see
if it works. Meanwhile, it exposed another gnulib bug:
getgroups.c: In function `rpl_getgroups':
getgroups.c:45: warning: implicit declaration of function `getgroups'
I'm committing these followups. A nicer gnulib patch would involve
declaring rpl_getgroups in unistd.in.h, and modifying the unistd module to
be aware of whether rpl_getgroups is needed; but this smaller patch does
the trick for now.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkkBtj0ACgkQ84KuGfSFAYDl/ACgpxr2trm+l2sXOu77eGCLDyWV
wlgAn1JFaKljzsevaw6WmXBrr1Pw9Z50
=o7KP
-----END PGP SIGNATURE-----
>From e2cdf35545f7834797a6d6dfb493f239d0fde479 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Fri, 24 Oct 2008 05:36:20 -0600
Subject: [PATCH] getgroups: fix compilation when getgroups is available
* lib/getgroups.c (includes): Include <unistd.h> for getgroups,
but with <config.h> override of getgroups disabled.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 6 ++++++
lib/getgroups.c | 7 ++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cd514df..11a8b0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-24 Eric Blake <address@hidden>
+
+ getgroups: fix compilation when getgroups is available
+ * lib/getgroups.c (includes): Include <unistd.h> for getgroups,
+ but with <config.h> override of getgroups disabled.
+
2008-10-23 Bruno Haible <address@hidden>
Define a dummy SA_NODEFER macro on Interix.
diff --git a/lib/getgroups.c b/lib/getgroups.c
index a8a225a..a4df7ab 100644
--- a/lib/getgroups.c
+++ b/lib/getgroups.c
@@ -1,6 +1,6 @@
/* provide consistent interface to getgroups for systems that don't allow N==0
- Copyright (C) 1996, 1999, 2003, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1999, 2003, 2006, 2007, 2008 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,10 +19,13 @@
#include <config.h>
+#undef getgroups
+
#include <stdio.h>
#include <sys/types.h>
#include <errno.h>
#include <stdlib.h>
+#include <unistd.h>
#include "xalloc.h"
@@ -38,8 +41,6 @@ rpl_getgroups (int n, GETGROUPS_T *group)
GETGROUPS_T *gbuf;
int saved_errno;
-#undef getgroups
-
if (n != 0)
return getgroups (n, group);
--
1.6.0.2
>From 21bd2e490b0804a0223b7044e89d5d31bd9f6476 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Fri, 24 Oct 2008 05:42:10 -0600
Subject: [PATCH] AC_FUNC_GETGROUPS: Revert regression.
* lib/autoconf/functions.m4 (AC_FUNC_GETGROUPS): Only set
ac_cv_func_getgroups_works=no when it is not available.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 6 ++++++
lib/autoconf/functions.m4 | 15 +++++++++------
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c8dca18..0a83589 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-24 Eric Blake <address@hidden>
+
+ AC_FUNC_GETGROUPS: Revert regression.
+ * lib/autoconf/functions.m4 (AC_FUNC_GETGROUPS): Only set
+ ac_cv_func_getgroups_works=no when it is not available.
+
2008-10-23 Eric Blake <address@hidden>
Whitespace cleanup.
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 3999134..f478ccc 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -619,7 +619,6 @@ if test $ac_cv_func_getgroups = no; then
AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd])
fi
-ac_cv_func_getgroups_works=no
# Run the program to test the functionality of the system-supplied
# getgroups function only if there is such a function.
if test $ac_cv_func_getgroups = yes; then
@@ -627,12 +626,16 @@ if test $ac_cv_func_getgroups = yes; then
[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
[[/* On Ultrix 4.3, getgroups (0, 0) always fails. */
return getgroups (0, 0) == -1;]])],
- [ac_cv_func_getgroups_works=yes])
+ [ac_cv_func_getgroups_works=yes],
+ [ac_cv_func_getgroups_works=no],
+ [ac_cv_func_getgroups_works=no])
])
- if test $ac_cv_func_getgroups_works = yes; then
- AC_DEFINE(HAVE_GETGROUPS, 1,
- [Define to 1 if your system has a working `getgroups' function.])
- fi
+else
+ ac_cv_func_getgroups_works=no
+fi
+if test $ac_cv_func_getgroups_works = yes; then
+ AC_DEFINE(HAVE_GETGROUPS, 1,
+ [Define to 1 if your system has a working `getgroups' function.])
fi
LIBS=$ac_save_LIBS
])# AC_FUNC_GETGROUPS
--
1.6.0.2