Move the euidaccess() declaration to <unistd.h>.
authorBruno Haible <bruno@clisp.org>
Sun, 19 Oct 2008 10:43:15 +0000 (12:43 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 19 Oct 2008 10:43:15 +0000 (12:43 +0200)
ChangeLog
NEWS
lib/euidaccess.c
lib/euidaccess.h [deleted file]
lib/unistd.in.h
m4/euidaccess.m4
m4/unistd_h.m4
modules/euidaccess
modules/unistd

index 21dbe3c..703b63f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 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.
 
        Move the getdomainname() declaration to <unistd.h>.
diff --git a/NEWS b/NEWS
index 1656982..f9a5ad1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@ User visible incompatible changes
 
 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>.
 
index 9db7bb4..17eb724 100644 (file)
@@ -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>
diff --git a/lib/euidaccess.h b/lib/euidaccess.h
deleted file mode 100644 (file)
index 17b7e98..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#if ! HAVE_DECL_EUIDACCESS
-int euidaccess (char const *file, int mode);
-#endif
index 7a7983a..a73a201 100644 (file)
@@ -134,6 +134,21 @@ extern char **environ;
 #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@
 
index 7690a14..6dd49c3 100644 (file)
@@ -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_NONREENTRANT_EUIDACCESS],
 
 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
 ])
index b9da779..b4a6055 100644 (file)
@@ -36,6 +36,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   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 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   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])
index d1bd3e1..47d9716 100644 (file)
@@ -2,22 +2,23 @@ Description:
 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)
index a5a5b79..1822190 100644 (file)
@@ -28,6 +28,7 @@ unistd.h: unistd.in.h
              -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 @@ unistd.h: unistd.in.h
              -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' \