summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-rw-r--r--NEWS4
-rw-r--r--doc/posix-functions/fchmodat.texi2
-rw-r--r--lib/openat.h4
-rw-r--r--m4/fchmodat.m417
-rw-r--r--m4/openat.m48
-rw-r--r--modules/fchmodat42
-rw-r--r--modules/fchmodat-tests13
-rw-r--r--modules/openat4
-rw-r--r--modules/openat-tests6
10 files changed, 103 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index bdd74c69bf..4c743d96f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2011-11-02 Bruno Haible <bruno@clisp.org>
+
+ New module 'fchmodat', split off from module 'openat'.
+ * lib/openat.h (chmodat, lchmodat): Enable only if GNULIB_FCHMODAT is
+ defined.
+ * m4/fchmodat.m4: New file, extracted from m4/openat.m4.
+ * m4/openat.m4 (gl_FUNC_OPENAT): Don't set GNULIB_FCHMODAT. Don't test
+ for fchmodat, lchmod. Don't set HAVE_FCHMODAT.
+ * modules/fchmodat: New file, extracted from modules/openat.
+ * modules/openat (Files): Remove lib/fchmodat.c.
+ (configure.ac): Remove AC_LIBOBJ of fchmodat.
+ * modules/fchmodat-tests: New file, extracted from modules/openat-tests.
+ * modules/openat-tests (Files): Remove tests/test-fchmodat.c.
+ (Makefile.am): Remove rules for test-fchmodat.
+ * doc/posix-functions/fchmodat.texi: Mention module 'fchmodat' instead
+ of module 'openat'.
+ * NEWS: Mention the change.
+
2011-11-02 Jim Meyering <meyering@redhat.com>
putenv: indent #definition of "environ" to placate cppi
diff --git a/NEWS b/NEWS
index 477c61cf90..ad6a468bb5 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,10 @@ User visible incompatible changes
Date Modules Changes
+2011-11-01 openat This module no longer provides the fchmodat()
+ function. If you need this function, you now need
+ to request the 'fchmodat' module.
+
2011-11-01 alignof This module no longer provides the alignof() macro.
Use either alignof_slot() or alignof_type() instead.
diff --git a/doc/posix-functions/fchmodat.texi b/doc/posix-functions/fchmodat.texi
index 2ec42d7135..f15f67575f 100644
--- a/doc/posix-functions/fchmodat.texi
+++ b/doc/posix-functions/fchmodat.texi
@@ -4,7 +4,7 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fchmodat.html}
-Gnulib module: openat
+Gnulib module: fchmodat
Portability problems fixed by Gnulib:
@itemize
diff --git a/lib/openat.h b/lib/openat.h
index 6c4e06fee2..fcae664aee 100644
--- a/lib/openat.h
+++ b/lib/openat.h
@@ -64,6 +64,8 @@ lchownat (int fd, char const *file, uid_t owner, gid_t group)
#endif
+#if GNULIB_FCHMODAT
+
static inline int
chmodat (int fd, char const *file, mode_t mode)
{
@@ -76,6 +78,8 @@ lchmodat (int fd, char const *file, mode_t mode)
return fchmodat (fd, file, mode, AT_SYMLINK_NOFOLLOW);
}
+#endif
+
static inline int
statat (int fd, char const *name, struct stat *st)
{
diff --git a/m4/fchmodat.m4 b/m4/fchmodat.m4
new file mode 100644
index 0000000000..76d4a720d2
--- /dev/null
+++ b/m4/fchmodat.m4
@@ -0,0 +1,17 @@
+# fchmodat.m4 serial 1
+dnl Copyright (C) 2004-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,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Written by Jim Meyering.
+
+AC_DEFUN([gl_FUNC_FCHMODAT],
+[
+ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ AC_CHECK_FUNCS_ONCE([fchmodat lchmod])
+ if test $ac_cv_func_fchmodat != yes; then
+ HAVE_FCHMODAT=0
+ fi
+])
diff --git a/m4/openat.m4 b/m4/openat.m4
index 1886d0b6d6..5166caf5ef 100644
--- a/m4/openat.m4
+++ b/m4/openat.m4
@@ -1,4 +1,4 @@
-# serial 38
+# serial 39
# See if we need to use our replacement for Solaris' openat et al functions.
dnl Copyright (C) 2004-2011 Free Software Foundation, Inc.
@@ -14,7 +14,6 @@ AC_DEFUN([gl_FUNC_OPENAT],
GNULIB_OPENAT=1
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
- GNULIB_FCHMODAT=1
GNULIB_FSTATAT=1
GNULIB_MKDIRAT=1
@@ -22,7 +21,7 @@ AC_DEFUN([gl_FUNC_OPENAT],
GNULIB_UNLINKAT=1
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_CHECK_FUNCS_ONCE([fchmodat lchmod mkdirat openat unlinkat])
+ AC_CHECK_FUNCS_ONCE([mkdirat openat unlinkat])
AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
AC_REQUIRE([gl_FUNC_UNLINK])
case $ac_cv_func_openat+$gl_cv_func_lstat_dereferences_slashed_symlink in
@@ -42,9 +41,6 @@ AC_DEFUN([gl_FUNC_OPENAT],
HAVE_UNLINKAT=0 # No known system with unlinkat but not openat
gl_PREREQ_OPENAT;;
esac
- if test $ac_cv_func_fchmodat != yes; then
- HAVE_FCHMODAT=0
- fi
if test $ac_cv_func_mkdirat != yes; then
HAVE_MKDIRAT=0
fi
diff --git a/modules/fchmodat b/modules/fchmodat
new file mode 100644
index 0000000000..92d061a7dc
--- /dev/null
+++ b/modules/fchmodat
@@ -0,0 +1,42 @@
+Description:
+fchmodat() function: Change access permissions of a file at a directory.
+
+Files:
+lib/fchmodat.c
+lib/at-func.c
+lib/openat.h
+lib/openat-priv.h
+m4/fchmodat.m4
+
+Depends-on:
+dirent
+dosname
+errno
+extensions
+fchdir
+fcntl-h
+openat
+save-cwd
+stdbool
+sys_stat
+unistd
+
+configure.ac:
+gl_FUNC_FCHMODAT
+if test $HAVE_FCHMODAT = 0; then
+ AC_LIBOBJ([fchmodat])
+fi
+AC_REQUIRE([AC_C_INLINE]) dnl because 'inline' is used in lib/openat.h
+gl_MODULE_INDICATOR([fchmodat]) dnl for lib/openat.h
+gl_SYS_STAT_MODULE_INDICATOR([fchmodat])
+
+Makefile.am:
+
+Include:
+<sys/stat.h>
+
+License:
+GPL
+
+Maintainer:
+Jim Meyering, Eric Blake
diff --git a/modules/fchmodat-tests b/modules/fchmodat-tests
new file mode 100644
index 0000000000..a240129fc0
--- /dev/null
+++ b/modules/fchmodat-tests
@@ -0,0 +1,13 @@
+Files:
+tests/test-fchmodat.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-fchmodat
+check_PROGRAMS += test-fchmodat
+test_fchmodat_LDADD = $(LDADD) @LIBINTL@
diff --git a/modules/openat b/modules/openat
index aaf281854c..a25e83d59f 100644
--- a/modules/openat
+++ b/modules/openat
@@ -3,7 +3,6 @@ Open a file at a directory.
Files:
lib/at-func.c
-lib/fchmodat.c
lib/fstatat.c
lib/mkdirat.c
lib/openat.c
@@ -39,9 +38,6 @@ unlink [test $REPLACE_UNLINKAT = 1]
configure.ac:
gl_FUNC_OPENAT
AC_LIBOBJ([openat-proc])
-if test $HAVE_FCHMODAT = 0; then
- AC_LIBOBJ([fchmodat])
-fi
if test $ac_cv_func_fstatat = no || test $REPLACE_FSTATAT = 1; then
AC_LIBOBJ([fstatat])
fi
diff --git a/modules/openat-tests b/modules/openat-tests
index 461f1d4442..80000333dd 100644
--- a/modules/openat-tests
+++ b/modules/openat-tests
@@ -8,7 +8,6 @@ tests/test-fstatat.c
tests/test-mkdirat.c
tests/test-openat.c
tests/test-unlinkat.c
-tests/test-fchmodat.c
tests/signature.h
tests/macros.h
@@ -23,10 +22,9 @@ configure.ac:
Makefile.am:
TESTS += \
- test-fchmodat test-fstatat test-mkdirat test-openat test-unlinkat
+ test-fstatat test-mkdirat test-openat test-unlinkat
check_PROGRAMS += \
- test-fchmodat test-fstatat test-mkdirat test-openat test-unlinkat
-test_fchmodat_LDADD = $(LDADD) @LIBINTL@
+ test-fstatat test-mkdirat test-openat test-unlinkat
test_fstatat_LDADD = $(LDADD) @LIBINTL@
test_mkdirat_LDADD = $(LDADD) @LIBINTL@
test_openat_LDADD = $(LDADD) @LIBINTL@