changeset 10662:ad36db29dad7

Move the euidaccess() declaration to <unistd.h>.
author Bruno Haible <bruno@clisp.org>
date Sun, 19 Oct 2008 12:43:15 +0200
parents 65c9436dc0d3
children 2b0380d48ff6
files ChangeLog NEWS lib/euidaccess.c lib/euidaccess.h lib/unistd.in.h m4/euidaccess.m4 m4/unistd_h.m4 modules/euidaccess modules/unistd
diffstat 9 files changed, 49 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2008-10-18  Bruno Haible  <bruno@clisp.org>
+
+	Move the euidaccess() declaration to <unistd.h>.
+	* lib/euidaccess.h: Remove file.
+	* lib/unistd.in.h (euidaccess): New declaration.
+	* lib/euidaccess.c: Don't include euidaccess.h.
+	* m4/euidaccess.m4 (gl_FUNC_EUIDACCESS): Require gl_UNISTD_H_DEFAULTS.
+	Don't check whether euidaccess is declared. Set HAVE_EUIDACCESS.
+	* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_EUIDACCESS
+	and HAVE_EUIDACCESS.
+	* modules/euidaccess (Files): Remove lib/euidaccess.h.
+	(Depends-on): Add unistd.
+	(configure.ac): Invoke gl_UNISTD_MODULE_INDICATOR.
+	(Include): Specify <unistd.h> instead of euidaccess.h.
+	* modules/unistd (Makefile.am): Substitute GNULIB_EUIDACCESS and
+	HAVE_EUIDACCESS.
+	* NEWS: Mention the change.
+
 2008-10-18  Bruno Haible  <bruno@clisp.org>
 
 	* lib/xgetdomainname.c: Include <unistd.h> instead of getdomainname.h.
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@
 
 Date        Modules         Changes
 
+2008-10-18  euidaccess      The include file is changed from "euidaccess.h"
+                            to <unistd.h>.
+
 2008-10-18  getdomainname   The include file is changed from "getdomainname.h"
                             to <unistd.h>.
 
--- a/lib/euidaccess.c
+++ b/lib/euidaccess.c
@@ -1,6 +1,6 @@
 /* euidaccess -- check if effective user id can access file
 
-   Copyright (C) 1990, 1991, 1995, 1998, 2000, 2003, 2004, 2005, 2006
+   Copyright (C) 1990, 1991, 1995, 1998, 2000, 2003, 2004, 2005, 2006, 2008
    Free Software Foundation, Inc.
 
    This file is part of the GNU C Library.
@@ -23,7 +23,6 @@
 
 #ifndef _LIBC
 # include <config.h>
-# include "euidaccess.h"
 #endif
 
 #include <sys/types.h>
deleted file mode 100644
--- a/lib/euidaccess.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#if ! HAVE_DECL_EUIDACCESS
-int euidaccess (char const *file, int mode);
-#endif
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -134,6 +134,21 @@
 #endif
 
 
+#if @GNULIB_EUIDACCESS@
+# if !@HAVE_EUIDACCESS@
+/* Like access(), except that is uses the effective user id and group id of
+   the current process.  */
+extern int euidaccess (const char *filename, int mode);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef euidaccess
+# define euidaccess(f,m) \
+    (GL_LINK_WARNING ("euidaccess is unportable - " \
+                      "use gnulib module euidaccess for portability"), \
+     euidaccess (f, m))
+#endif
+
+
 #if @GNULIB_FCHDIR@
 # if @REPLACE_FCHDIR@
 
--- a/m4/euidaccess.m4
+++ b/m4/euidaccess.m4
@@ -1,5 +1,5 @@
-# euidaccess.m4 serial 8
-dnl Copyright (C) 2002-2007 Free Software Foundation, Inc.
+# euidaccess.m4 serial 9
+dnl Copyright (C) 2002-2008 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -17,12 +17,14 @@
 
 AC_DEFUN([gl_FUNC_EUIDACCESS],
 [
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+
   dnl Persuade glibc <unistd.h> to declare euidaccess().
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 
-  AC_CHECK_DECLS_ONCE([euidaccess])
   AC_REPLACE_FUNCS(euidaccess)
   if test $ac_cv_func_euidaccess = no; then
+    HAVE_EUIDACCESS=0
     gl_PREREQ_EUIDACCESS
   fi
 ])
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -36,6 +36,7 @@
   GNULIB_CLOSE=0;            AC_SUBST([GNULIB_CLOSE])
   GNULIB_DUP2=0;             AC_SUBST([GNULIB_DUP2])
   GNULIB_ENVIRON=0;          AC_SUBST([GNULIB_ENVIRON])
+  GNULIB_EUIDACCESS=0;       AC_SUBST([GNULIB_EUIDACCESS])
   GNULIB_FCHDIR=0;           AC_SUBST([GNULIB_FCHDIR])
   GNULIB_FSYNC=0;            AC_SUBST([GNULIB_FSYNC])
   GNULIB_FTRUNCATE=0;        AC_SUBST([GNULIB_FTRUNCATE])
@@ -52,6 +53,7 @@
   GNULIB_WRITE=0;            AC_SUBST([GNULIB_WRITE])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_DUP2=1;            AC_SUBST([HAVE_DUP2])
+  HAVE_EUIDACCESS=1;      AC_SUBST([HAVE_EUIDACCESS])
   HAVE_FSYNC=1;           AC_SUBST([HAVE_FSYNC])
   HAVE_FTRUNCATE=1;       AC_SUBST([HAVE_FTRUNCATE])
   HAVE_GETDOMAINNAME=1;   AC_SUBST([HAVE_GETDOMAINNAME])
--- a/modules/euidaccess
+++ b/modules/euidaccess
@@ -2,22 +2,23 @@
 euidaccess() function: check effective user's permissions for a file.
 
 Files:
-lib/euidaccess.h
 lib/euidaccess.c
 m4/euidaccess.m4
 
 Depends-on:
+unistd
 extensions
 group-member
 sys_stat
 
 configure.ac:
 gl_FUNC_EUIDACCESS
+gl_UNISTD_MODULE_INDICATOR([euidaccess])
 
 Makefile.am:
 
 Include:
-"euidaccess.h"
+<unistd.h>
 
 Link:
 $(LIB_EACCESS)
--- a/modules/unistd
+++ b/modules/unistd
@@ -28,6 +28,7 @@
 	      -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \
 	      -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
 	      -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \
+	      -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \
 	      -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
 	      -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \
 	      -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
@@ -43,6 +44,7 @@
 	      -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \
 	      -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
 	      -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
+	      -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \
 	      -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \
 	      -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
 	      -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \