From: Eric Blake Date: Sat, 19 Sep 2009 14:03:45 +0000 (-0600) Subject: openat: simplify use of at-func.c X-Git-Tag: v0.1~5459 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=41861b05c9192bf7cd65af0530d1097d0099b84f;p=gnulib.git openat: simplify use of at-func.c * lib/at-func.c (includes): Include prerequisites here, to simplify requirements on client files. * lib/openat-priv.h: Add double-inclusion guard. * lib/faccessat.c (includes): Simplify. * lib/fchmodat.c (includes): Likewise. * lib/fchownat.c (includes): Likewise. * lib/mkdirat.c (includes): Likewise. * lib/mkfifoat.c (includes): Likewise. * lib/symlinkat.c (includes): Likewise. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 3e8e24b6e..6b174801b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2009-09-19 Eric Blake + openat: simplify use of at-func.c + * lib/at-func.c (includes): Include prerequisites here, to + simplify requirements on client files. + * lib/openat-priv.h: Add double-inclusion guard. + * lib/faccessat.c (includes): Simplify. + * lib/fchmodat.c (includes): Likewise. + * lib/fchownat.c (includes): Likewise. + * lib/mkdirat.c (includes): Likewise. + * lib/mkfifoat.c (includes): Likewise. + * lib/symlinkat.c (includes): Likewise. + openat: allow return of fd 0 * modules/chdir-long (Depends-on): Relax openat-safer to openat. * modules/save-cwd (Depends-on): Replace fcntl-safer with diff --git a/lib/at-func.c b/lib/at-func.c index 3188770c6..75c80d3c9 100644 --- a/lib/at-func.c +++ b/lib/at-func.c @@ -16,6 +16,11 @@ /* written by Jim Meyering */ +#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ +#include "openat.h" +#include "openat-priv.h" +#include "save-cwd.h" + #ifdef AT_FUNC_USE_F1_COND # define CALL_FUNC(F) \ (flag == AT_FUNC_USE_F1_COND \ diff --git a/lib/faccessat.c b/lib/faccessat.c index 42479c7fd..de2dc2efd 100644 --- a/lib/faccessat.c +++ b/lib/faccessat.c @@ -20,11 +20,6 @@ #include -#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ -#include "openat.h" -#include "openat-priv.h" -#include "save-cwd.h" - #ifndef HAVE_ACCESS /* Mingw lacks access, but it also lacks real vs. effective ids, so the gnulib euidaccess module is good enough. */ diff --git a/lib/fchmodat.c b/lib/fchmodat.c index 53cafe06d..55ae61836 100644 --- a/lib/fchmodat.c +++ b/lib/fchmodat.c @@ -20,10 +20,7 @@ #include -#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ -#include "openat.h" -#include "openat-priv.h" -#include "save-cwd.h" +#include #ifndef HAVE_LCHMOD /* Use a different name, to avoid conflicting with any diff --git a/lib/fchownat.c b/lib/fchownat.c index 6da353734..09b4aa8af 100644 --- a/lib/fchownat.c +++ b/lib/fchownat.c @@ -25,11 +25,6 @@ #include -#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ -#include "openat.h" -#include "openat-priv.h" -#include "save-cwd.h" - /* Replacement for Solaris' function by the same name. Invoke chown or lchown on file, FILE, using OWNER and GROUP, in the directory open on descriptor FD. If FLAG is AT_SYMLINK_NOFOLLOW, then diff --git a/lib/mkdirat.c b/lib/mkdirat.c index 33ece9ccd..adb11f00e 100644 --- a/lib/mkdirat.c +++ b/lib/mkdirat.c @@ -20,11 +20,6 @@ #include -#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ -#include "openat.h" -#include "openat-priv.h" -#include "save-cwd.h" - /* Solaris 10 has no function like this. Create a subdirectory, FILE, with mode MODE, in the directory open on descriptor FD. If possible, do it without changing the diff --git a/lib/mkfifoat.c b/lib/mkfifoat.c index a230b0048..29fc070c6 100644 --- a/lib/mkfifoat.c +++ b/lib/mkfifoat.c @@ -20,11 +20,6 @@ #include -#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ -#include "openat.h" -#include "openat-priv.h" -#include "save-cwd.h" - #ifndef HAVE_MKFIFO # define HAVE_MKFIFO 0 #endif diff --git a/lib/openat-priv.h b/lib/openat-priv.h index 228041629..fa286b509 100644 --- a/lib/openat-priv.h +++ b/lib/openat-priv.h @@ -17,6 +17,9 @@ /* written by Jim Meyering */ +#ifndef _GL_HEADER_OPENAT_PRIV +#define _GL_HEADER_OPENAT_PRIV + #include #include @@ -32,3 +35,5 @@ char *openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file); || (Errno) == EPERM || (Errno) == EACCES \ || (Errno) == ENOSYS /* Solaris 8 */ \ || (Errno) == EOPNOTSUPP /* FreeBSD */) + +#endif /* _GL_HEADER_OPENAT_PRIV */ diff --git a/lib/symlinkat.c b/lib/symlinkat.c index 6fe752f14..fd129ea01 100644 --- a/lib/symlinkat.c +++ b/lib/symlinkat.c @@ -20,11 +20,6 @@ #include -#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ -#include "openat.h" -#include "openat-priv.h" -#include "save-cwd.h" - #if !HAVE_SYMLINK /* Mingw lacks symlink, so this wrapper is trivial. */