* lib/unistd.in.h (group_member): New declaration.
* lib/group-member.h: Remove file.
* lib/group-member.c: Include <unistd.h> instead of group-member.h.
* tests/test-unistd-c++.cc: Check signature of group_member.
* m4/group-member.m4 (gl_FUNC_GROUP_MEMBER): Require
gl_UNISTD_H_DEFAULTS. Set HAVE_GROUP_MEMBER.
* m4/unistd_h.m4 (gl_UNISTD_H): Check whether group_member is declared.
(gl_UNISTD_H_DEFAULTS): Initialize GNULIB_GROUP_MEMBER,
HAVE_GROUP_MEMBER.
* modules/group-member (Files): Remove lib/group-member.h.
(Depends-on): Add unistd. Specify conditions.
(configure.ac): Invoke gl_UNISTD_MODULE_INDICATOR.
(Include): Change to <unistd.h>.
* modules/unistd (Makefile.am): Substitute GNULIB_GROUP_MEMBER,
HAVE_GROUP_MEMBER.
* NEWS: Mention the change.
* lib/euidaccess.c: Don't include group-member.h.
+2011-05-11 Bruno Haible <bruno@clisp.org>
+
+ group-member: Declare function in <unistd.h>.
+ * lib/unistd.in.h (group_member): New declaration.
+ * lib/group-member.h: Remove file.
+ * lib/group-member.c: Include <unistd.h> instead of group-member.h.
+ * tests/test-unistd-c++.cc: Check signature of group_member.
+ * m4/group-member.m4 (gl_FUNC_GROUP_MEMBER): Require
+ gl_UNISTD_H_DEFAULTS. Set HAVE_GROUP_MEMBER.
+ * m4/unistd_h.m4 (gl_UNISTD_H): Check whether group_member is declared.
+ (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_GROUP_MEMBER,
+ HAVE_GROUP_MEMBER.
+ * modules/group-member (Files): Remove lib/group-member.h.
+ (Depends-on): Add unistd. Specify conditions.
+ (configure.ac): Invoke gl_UNISTD_MODULE_INDICATOR.
+ (Include): Change to <unistd.h>.
+ * modules/unistd (Makefile.am): Substitute GNULIB_GROUP_MEMBER,
+ HAVE_GROUP_MEMBER.
+ * NEWS: Mention the change.
+ * lib/euidaccess.c: Don't include group-member.h.
+
2011-05-11 Bruno Haible <bruno@clisp.org>
group-member: Document module.
Date Modules Changes
+2011-05-11 group-member The include file is changed from "group-member.h"
+ to <unistd.h>.
+
2011-05-02 exit The module is removed. It was deprecated
on 2010-03-05. Use 'stdlib' directly instead.
# undef stat
# define stat stat64
-#else
-
-# include "group-member.h"
-
#endif
/* Return 0 if the user has permission of type MODE on FILE;
#include <config.h>
-#include "group-member.h"
+/* Specification. */
+#include <unistd.h>
#include <stdbool.h>
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
-#include <unistd.h>
-
#include "xalloc.h"
struct group_info
+++ /dev/null
-/* Determine whether group id is in calling user's group list.
-
- Copyright (C) 1994, 1997, 2003, 2009-2011 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
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef GROUP_MEMBER_H_
-# define GROUP_MEMBER_H_ 1
-
-# include <sys/types.h>
-
-int group_member (gid_t);
-
-#endif /* GROUP_MEMBER_H_ */
#endif
+#if @GNULIB_GROUP_MEMBER@
+/* Determine whether group id is in calling user's group list. */
+# if !@HAVE_GROUP_MEMBER@
+_GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
+# endif
+_GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
+_GL_CXXALIASWARN (group_member);
+#elif defined GNULIB_POSIXCHECK
+# undef group_member
+# if HAVE_RAW_DECL_GROUP_MEMBER
+_GL_WARN_ON_USE (group_member, "group_member is unportable - "
+ "use gnulib module group-member for portability");
+# endif
+#endif
+
+
#if @GNULIB_LCHOWN@
/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
to GID (if GID is not -1). Do not follow symbolic links.
-# serial 12
+# serial 13
# Copyright (C) 1999-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc.
AC_DEFUN([gl_FUNC_GROUP_MEMBER],
[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+
dnl Persuade glibc <unistd.h> to declare group_member().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
dnl Do this replacement check manually because I want the hyphen
dnl (not the underscore) in the filename.
AC_CHECK_FUNC([group_member], , [
+ HAVE_GROUP_MEMBER=0
+ ])
+ if test $HAVE_GROUP_MEMBER = 0; then
AC_LIBOBJ([group-member])
gl_PREREQ_GROUP_MEMBER
- ])
+ fi
])
# Prerequisites of lib/group-member.c.
-# unistd_h.m4 serial 55
+# unistd_h.m4 serial 56
dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat
fsync ftruncate getcwd getdomainname getdtablesize getgroups
gethostname getlogin getlogin_r getpagesize getusershell setusershell
- endusershell lchown link linkat lseek pipe pipe2 pread pwrite readlink
- readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat
+ endusershell group_member lchown link linkat lseek pipe pipe2 pread pwrite
+ readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat
usleep])
])
GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R])
GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE])
GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL])
+ GNULIB_GROUP_MEMBER=0; AC_SUBST([GNULIB_GROUP_MEMBER])
GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN])
GNULIB_LINK=0; AC_SUBST([GNULIB_LINK])
GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT])
HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME])
HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN])
HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE])
+ HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER])
HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN])
HAVE_LINK=1; AC_SUBST([HAVE_LINK])
HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT])
Determine whether the current process has the permissions of a given group ID.
Files:
-lib/group-member.h
lib/group-member.c
m4/group-member.m4
Depends-on:
+unistd
extensions
-getgroups
-xalloc
-stdbool
+getgroups [test $HAVE_GROUP_MEMBER = 0]
+xalloc [test $HAVE_GROUP_MEMBER = 0]
+stdbool [test $HAVE_GROUP_MEMBER = 0]
configure.ac:
gl_FUNC_GROUP_MEMBER
+gl_UNISTD_MODULE_INDICATOR([group-member])
Makefile.am:
Include:
-"group-member.h"
+<unistd.h>
License:
GPL
-e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
-e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
-e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \
+ -e 's|@''GNULIB_GROUP_MEMBER''@|$(GNULIB_GROUP_MEMBER)|g' \
-e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
-e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \
-e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \
-e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
-e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \
-e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
+ -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \
-e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \
-e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \
-e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \
SIGNATURE_CHECK (GNULIB_NAMESPACE::endusershell, void, (void));
#endif
+#if GNULIB_TEST_GROUP_MEMBER
+SIGNATURE_CHECK (GNULIB_NAMESPACE::group_member, int, (gid_t));
+#endif
+
#if GNULIB_TEST_LCHOWN
SIGNATURE_CHECK (GNULIB_NAMESPACE::lchown, int, (char const *, uid_t, gid_t));
#endif