summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog38
-rw-r--r--NEWS4
-rw-r--r--doc/posix-functions/fstat.texi13
-rw-r--r--lib/fchdir.c14
-rw-r--r--lib/fstat.c82
-rw-r--r--lib/sys_stat.in.h21
-rw-r--r--m4/fchdir.m44
-rw-r--r--m4/fstat.m428
-rw-r--r--m4/sys_stat_h.m45
-rw-r--r--modules/acl1
-rw-r--r--modules/chdir-safer1
-rw-r--r--modules/chown1
-rw-r--r--modules/copy-file1
-rw-r--r--modules/fchdir1
-rw-r--r--modules/fdopendir1
-rw-r--r--modules/fopen1
-rw-r--r--modules/fstat31
-rw-r--r--modules/fts1
-rw-r--r--modules/getcwd1
-rw-r--r--modules/isapipe1
-rw-r--r--modules/linkat1
-rw-r--r--modules/lseek1
-rw-r--r--modules/mkdir-p1
-rw-r--r--modules/open1
-rw-r--r--modules/openat1
-rw-r--r--modules/read-file1
-rw-r--r--modules/renameat1
-rw-r--r--modules/sys_stat1
-rw-r--r--modules/sys_stat-tests1
-rw-r--r--modules/utimens1
-rw-r--r--tests/test-sys_stat-c++.cc2
31 files changed, 231 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index d499eccce1..c7bc060ee7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,43 @@
2011-09-25 Bruno Haible <bruno@clisp.org>
+ New module 'fstat'.
+ * lib/sys_stat.in.h (fstat): Declare only if GNULIB_FSTAT is set.
+ * lib/fstat.c: New file, based on a piece of lib/fchdir.c.
+ * lib/fchdir.c (rpl_fstat): Remove function.
+ * m4/fstat.m4: New file.
+ * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't set REPLACE_FSTAT.
+ * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Test whether fstat is
+ declared.
+ (gl_SYS_STAT_H_DEFAULTS): Initialize GNULIB_FSTAT.
+ * modules/sys_stat (Makefile.am): Substitute GNULIB_FSTAT.
+ * modules/fstat: New file.
+ * modules/sys_stat-tests (Depends-on): Remove fstat-tests.
+ * tests/test-sys_stat-c++.cc (fstat): Check only if GNULIB_TEST_FSTAT
+ is set.
+ * doc/posix-functions/fstat.texi: Mention the new module and the
+ problem on MSVC.
+ * NEWS: Mention the change.
+ * modules/acl (Depends-on): Add fstat.
+ * modules/chdir-safer (Depends-on): Likewise.
+ * modules/chown (Depends-on): Likewise.
+ * modules/copy-file (Depends-on): Likewise.
+ * modules/fchdir (Depends-on): Likewise.
+ * modules/fdopendir (Depends-on): Likewise.
+ * modules/fopen (Depends-on): Likewise.
+ * modules/fts (Depends-on): Likewise.
+ * modules/getcwd (Depends-on): Likewise.
+ * modules/isapipe (Depends-on): Likewise.
+ * modules/linkat (Depends-on): Likewise.
+ * modules/lseek (Depends-on): Likewise.
+ * modules/mkdir-p (Depends-on): Likewise.
+ * modules/open (Depends-on): Likewise.
+ * modules/openat (Depends-on): Likewise.
+ * modules/read-file (Depends-on): Likewise.
+ * modules/renameat (Depends-on): Likewise.
+ * modules/utimens (Depends-on): Likewise.
+
+2011-09-25 Bruno Haible <bruno@clisp.org>
+
linkat: Fix compilation on MSVC 9.
* lib/linkat.c: Don't include <stdint.h>.
diff --git a/NEWS b/NEWS
index 21f4708215..85d3d43b5f 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,10 @@ User visible incompatible changes
Date Modules Changes
+2011-09-25 sys_stat This module no longer provides the fstat()
+ function. If you need this function, you now need
+ to request the 'fstat' module.
+
2011-09-23 signal This module is renamed to 'signal-h'.
2011-09-22 select The link requirements of this module are changed
diff --git a/doc/posix-functions/fstat.texi b/doc/posix-functions/fstat.texi
index 967de79b53..acd0296de3 100644
--- a/doc/posix-functions/fstat.texi
+++ b/doc/posix-functions/fstat.texi
@@ -4,18 +4,21 @@
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fstat.html}
-Gnulib module: ---
+Gnulib module: fstat
Portability problems fixed by Gnulib:
@itemize
-@end itemize
-
-Portability problems not fixed by Gnulib:
-@itemize
+@item
+This function crashes when invoked with invalid arguments on some platforms:
+MSVC 9.
@item
On platforms where @code{off_t} is a 32-bit type, @code{fstat} may not correctly
report the size of files or block devices larger than 2 GB. The fix is to
use the @code{AC_SYS_LARGEFILE} macro.
+@end itemize
+
+Portability problems not fixed by Gnulib:
+@itemize
@item
On Cygwin, @code{fstat} applied to the file descriptors 0 and 1, returns
different @code{st_ino} values, even if standard input and standard output
diff --git a/lib/fchdir.c b/lib/fchdir.c
index 63c287b207..a3623ed36e 100644
--- a/lib/fchdir.c
+++ b/lib/fchdir.c
@@ -197,20 +197,6 @@ _gl_directory_name (int fd)
return NULL;
}
-#if REPLACE_OPEN_DIRECTORY
-/* Return stat information about FD in STATBUF. Needed when
- rpl_open() used a dummy file to work around an open() that can't
- normally visit directories. */
-# undef fstat
-int
-rpl_fstat (int fd, struct stat *statbuf)
-{
- if (0 <= fd && fd < dirs_allocated && dirs[fd].name != NULL)
- return stat (dirs[fd].name, statbuf);
- return fstat (fd, statbuf);
-}
-#endif
-
/* Implement fchdir() in terms of chdir(). */
diff --git a/lib/fstat.c b/lib/fstat.c
new file mode 100644
index 0000000000..db5b17c1ed
--- /dev/null
+++ b/lib/fstat.c
@@ -0,0 +1,82 @@
+/* fstat() replacement.
+ Copyright (C) 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/>. */
+
+/* If the user's config.h happens to include <sys/stat.h>, let it include only
+ the system's <sys/stat.h> here, so that orig_fstat doesn't recurse to
+ rpl_fstat. */
+#define __need_system_sys_stat_h
+#include <config.h>
+
+/* Get the original definition of fstat. It might be defined as a macro. */
+#include <sys/types.h>
+#include <sys/stat.h>
+#undef __need_system_sys_stat_h
+
+static inline int
+orig_fstat (int fd, struct stat *buf)
+{
+ return fstat (fd, buf);
+}
+
+/* Specification. */
+/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
+ eliminates this include because of the preliminary #include <sys/stat.h>
+ above. */
+#include "sys/stat.h"
+
+#include <errno.h>
+#include <unistd.h>
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static inline int
+fstat_nothrow (int fd, struct stat *buf)
+{
+ int result;
+
+ TRY_MSVC_INVAL
+ {
+ result = orig_fstat (fd, buf);
+ }
+ CATCH_MSVC_INVAL
+ {
+ result = -1;
+ errno = EBADF;
+ }
+ DONE_MSVC_INVAL;
+
+ return result;
+}
+#else
+# define fstat_nothrow orig_fstat
+#endif
+
+int
+rpl_fstat (int fd, struct stat *buf)
+{
+#if REPLACE_FCHDIR && REPLACE_OPEN_DIRECTORY
+ /* Handle the case when rpl_open() used a dummy file descriptor to work
+ around an open() that can't normally visit directories. */
+ const char *name = _gl_directory_name (fd);
+ if (name != NULL)
+ return stat (name, buf);
+#endif
+
+ return fstat_nothrow (fd, buf);
+}
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index cc59c75ea1..9f7bf76ed8 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -319,16 +319,25 @@ _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
#endif
-#if @REPLACE_FSTAT@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define fstat rpl_fstat
-# endif
+#if @GNULIB_FSTAT@
+# if @REPLACE_FSTAT@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef fstat
+# define fstat rpl_fstat
+# endif
_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
-#else
+# else
_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
-#endif
+# endif
_GL_CXXALIASWARN (fstat);
+#elif defined GNULIB_POSIXCHECK
+# undef fstat
+# if HAVE_RAW_DECL_FSTAT
+_GL_WARN_ON_USE (fstat, "fstat has portability problems - "
+ "use gnulib module fstat for portability");
+# endif
+#endif
#if @GNULIB_FSTATAT@
diff --git a/m4/fchdir.m4 b/m4/fchdir.m4
index 602aad9250..30e0af1639 100644
--- a/m4/fchdir.m4
+++ b/m4/fchdir.m4
@@ -1,4 +1,4 @@
-# fchdir.m4 serial 19
+# fchdir.m4 serial 20
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,
@@ -8,7 +8,6 @@ AC_DEFUN([gl_FUNC_FCHDIR],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
- AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
AC_CHECK_DECLS_ONCE([fchdir])
if test $ac_cv_have_decl_fchdir = no; then
@@ -34,7 +33,6 @@ AC_DEFUN([gl_FUNC_FCHDIR],
if test "$gl_cv_func_open_directory_works" != yes; then
AC_DEFINE([REPLACE_OPEN_DIRECTORY], [1], [Define to 1 if open() should
work around the inability to open a directory.])
- REPLACE_FSTAT=1
fi
fi
])
diff --git a/m4/fstat.m4 b/m4/fstat.m4
new file mode 100644
index 0000000000..0daea88b86
--- /dev/null
+++ b/m4/fstat.m4
@@ -0,0 +1,28 @@
+# fstat.m4 serial 1
+dnl Copyright (C) 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.
+
+AC_DEFUN([gl_FUNC_FSTAT],
+[
+ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+ AC_REQUIRE([gl_MSVC_INVAL])
+ if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
+ REPLACE_FSTAT=1
+ fi
+ dnl Replace fstat() for supporting the gnulib-defined open() on directories.
+ m4_ifdef([gl_FUNC_FCHDIR], [
+ gl_TEST_FCHDIR
+ if test $HAVE_FCHDIR = 0 \
+ && test "$gl_cv_func_open_directory_works" != yes; then
+ REPLACE_FSTAT=1
+ fi
+ ])
+])
+
+# Prerequisites of lib/fstat.c.
+AC_DEFUN([gl_PREREQ_FSTAT],
+[
+ AC_REQUIRE([AC_C_INLINE])
+])
diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4
index a3e46ca965..83ebac613b 100644
--- a/m4/sys_stat_h.m4
+++ b/m4/sys_stat_h.m4
@@ -1,4 +1,4 @@
-# sys_stat_h.m4 serial 25 -*- Autoconf -*-
+# sys_stat_h.m4 serial 26 -*- Autoconf -*-
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,
@@ -33,7 +33,7 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
- ]], [fchmodat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
+ ]], [fchmodat fstat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
mknod mknodat stat utimensat])
]) # gl_HEADER_SYS_STAT_H
@@ -50,6 +50,7 @@ AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT])
+ GNULIB_FSTAT=0; AC_SUBST([GNULIB_FSTAT])
GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT])
GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS])
GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
diff --git a/modules/acl b/modules/acl
index f5913c213b..434a634d52 100644
--- a/modules/acl
+++ b/modules/acl
@@ -12,6 +12,7 @@ m4/acl.m4
Depends-on:
error
+fstat
gettext-h
quote
sys_stat
diff --git a/modules/chdir-safer b/modules/chdir-safer
index 095a4086cc..7455b32155 100644
--- a/modules/chdir-safer
+++ b/modules/chdir-safer
@@ -10,6 +10,7 @@ Depends-on:
errno
fchdir
fcntl-h
+fstat
open
same-inode
stdbool
diff --git a/modules/chown b/modules/chown
index 1c271f0542..9c7294b0ef 100644
--- a/modules/chown
+++ b/modules/chown
@@ -8,6 +8,7 @@ m4/chown.m4
Depends-on:
unistd
+fstat [test $HAVE_CHOWN = 0 || test $REPLACE_CHOWN = 1]
open [test $HAVE_CHOWN = 0 || test $REPLACE_CHOWN = 1]
stat [test $HAVE_CHOWN = 0 || test $REPLACE_CHOWN = 1]
stdbool [test $HAVE_CHOWN = 0 || test $REPLACE_CHOWN = 1]
diff --git a/modules/copy-file b/modules/copy-file
index 4ca553e302..6a35db2733 100644
--- a/modules/copy-file
+++ b/modules/copy-file
@@ -10,6 +10,7 @@ Depends-on:
acl
binary-io
error
+fstat
full-write
gettext-h
open
diff --git a/modules/fchdir b/modules/fchdir
index 80b2bb826d..39a62e5201 100644
--- a/modules/fchdir
+++ b/modules/fchdir
@@ -16,6 +16,7 @@ dup2 [test $HAVE_FCHDIR = 0]
fcntl [test $HAVE_FCHDIR = 0]
fcntl-h [test $HAVE_FCHDIR = 0]
filenamecat-lgpl [test $HAVE_FCHDIR = 0]
+fstat [test $HAVE_FCHDIR = 0]
getcwd-lgpl [test $HAVE_FCHDIR = 0]
malloc-posix [test $HAVE_FCHDIR = 0]
open [test $HAVE_FCHDIR = 0]
diff --git a/modules/fdopendir b/modules/fdopendir
index 94168faa09..9cdf58e1d0 100644
--- a/modules/fdopendir
+++ b/modules/fdopendir
@@ -13,6 +13,7 @@ extensions
dup [test $HAVE_FDOPENDIR = 0]
errno [test $HAVE_FDOPENDIR = 0]
fchdir [test $HAVE_FDOPENDIR = 0]
+fstat [test $HAVE_FDOPENDIR = 0]
openat-die [test $HAVE_FDOPENDIR = 0]
opendir [test $HAVE_FDOPENDIR = 0]
save-cwd [test $HAVE_FDOPENDIR = 0]
diff --git a/modules/fopen b/modules/fopen
index 64a7559e6e..b975faacff 100644
--- a/modules/fopen
+++ b/modules/fopen
@@ -9,6 +9,7 @@ Depends-on:
stdio
largefile
unistd [test $REPLACE_FOPEN = 1]
+fstat [test $REPLACE_FOPEN = 1]
configure.ac:
gl_FUNC_FOPEN
diff --git a/modules/fstat b/modules/fstat
new file mode 100644
index 0000000000..12840d47f7
--- /dev/null
+++ b/modules/fstat
@@ -0,0 +1,31 @@
+Description:
+fstat() function: query file information
+
+Files:
+lib/fstat.c
+m4/fstat.m4
+
+Depends-on:
+sys_stat
+largefile
+unistd [test $REPLACE_STAT = 1]
+msvc-inval [test $REPLACE_STAT = 1]
+
+configure.ac:
+gl_FUNC_FSTAT
+if test $REPLACE_FSTAT = 1; then
+ AC_LIBOBJ([fstat])
+ gl_PREREQ_FSTAT
+fi
+gl_SYS_STAT_MODULE_INDICATOR([fstat])
+
+Makefile.am:
+
+Include:
+<sys/stat.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
diff --git a/modules/fts b/modules/fts
index 8aae6d89f9..b879134810 100644
--- a/modules/fts
+++ b/modules/fts
@@ -18,6 +18,7 @@ dup
fchdir
fcntl-h
fcntl-safer
+fstat
hash
i-ring
lstat
diff --git a/modules/getcwd b/modules/getcwd
index c68cd8ea98..aa3fe69a86 100644
--- a/modules/getcwd
+++ b/modules/getcwd
@@ -16,6 +16,7 @@ mempcpy [test $REPLACE_GETCWD = 1]
d-ino [test $REPLACE_GETCWD = 1]
memmove [test $REPLACE_GETCWD = 1]
openat [test $REPLACE_GETCWD = 1]
+fstat [test $REPLACE_GETCWD = 1]
opendir [test $REPLACE_GETCWD = 1]
closedir [test $REPLACE_GETCWD = 1]
stdbool [test $REPLACE_GETCWD = 1]
diff --git a/modules/isapipe b/modules/isapipe
index 945df3ed8a..25a87b19de 100644
--- a/modules/isapipe
+++ b/modules/isapipe
@@ -11,6 +11,7 @@ stdbool [test $HAVE_ISAPIPE = 0]
sys_stat [test $HAVE_ISAPIPE = 0]
unistd [test $HAVE_ISAPIPE = 0]
msvc-nothrow [test $HAVE_ISAPIPE = 0]
+fstat [test $HAVE_ISAPIPE = 0]
configure.ac:
gl_ISAPIPE
diff --git a/modules/linkat b/modules/linkat
index 3392e57d61..77f08d01b4 100644
--- a/modules/linkat
+++ b/modules/linkat
@@ -16,6 +16,7 @@ dosname [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
errno [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
fcntl-h [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
filenamecat-lgpl [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+fstat [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
getcwd-lgpl [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
openat [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
link [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
diff --git a/modules/lseek b/modules/lseek
index c43027354c..1ec6e2a902 100644
--- a/modules/lseek
+++ b/modules/lseek
@@ -9,6 +9,7 @@ Depends-on:
unistd
largefile
msvc-nothrow [test $REPLACE_LSEEK = 1]
+fstat [test $REPLACE_LSEEK = 1]
configure.ac:
gl_FUNC_LSEEK
diff --git a/modules/mkdir-p b/modules/mkdir-p
index 562c1e2672..fed3490692 100644
--- a/modules/mkdir-p
+++ b/modules/mkdir-p
@@ -11,6 +11,7 @@ m4/mkdir-p.m4
Depends-on:
error
fcntl-h
+fstat
gettext-h
lchmod
lchown
diff --git a/modules/open b/modules/open
index a504aee9c8..398efe47e7 100644
--- a/modules/open
+++ b/modules/open
@@ -9,6 +9,7 @@ m4/mode_t.m4
Depends-on:
fcntl-h
largefile
+fstat [test $REPLACE_OPEN = 1]
stat [test $REPLACE_OPEN = 1]
configure.ac:
diff --git a/modules/openat b/modules/openat
index 5b32d85499..137f9ec592 100644
--- a/modules/openat
+++ b/modules/openat
@@ -22,6 +22,7 @@ extensions
fchdir
fcntl-h
fdopendir
+fstat
gettext-h
intprops
largefile
diff --git a/modules/read-file b/modules/read-file
index 0f380ca9a9..506e88f0ab 100644
--- a/modules/read-file
+++ b/modules/read-file
@@ -7,6 +7,7 @@ lib/read-file.c
m4/read-file.m4
Depends-on:
+fstat
ftello
malloc-posix
realloc-posix
diff --git a/modules/renameat b/modules/renameat
index 6e1012a32b..3d0d568aac 100644
--- a/modules/renameat
+++ b/modules/renameat
@@ -12,6 +12,7 @@ extensions
fcntl-h
dosname [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
filenamecat-lgpl [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
+fstat [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
getcwd-lgpl [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
openat [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
rename [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
diff --git a/modules/sys_stat b/modules/sys_stat
index 531562c98d..372e65389a 100644
--- a/modules/sys_stat
+++ b/modules/sys_stat
@@ -32,6 +32,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
-e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \
+ -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \
-e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \
-e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \
-e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \
diff --git a/modules/sys_stat-tests b/modules/sys_stat-tests
index bfdc1a26ca..a5ede77aba 100644
--- a/modules/sys_stat-tests
+++ b/modules/sys_stat-tests
@@ -4,7 +4,6 @@ tests/test-sys_stat.c
Depends-on:
verify
sys_stat-c++-tests
-fstat-tests
configure.ac:
diff --git a/modules/utimens b/modules/utimens
index c607608c0b..ed60466964 100644
--- a/modules/utimens
+++ b/modules/utimens
@@ -10,6 +10,7 @@ m4/utimes.m4
Depends-on:
errno
+fstat
lstat
gettime
stat-time
diff --git a/tests/test-sys_stat-c++.cc b/tests/test-sys_stat-c++.cc
index 2efa9b7e30..b8034203f0 100644
--- a/tests/test-sys_stat-c++.cc
+++ b/tests/test-sys_stat-c++.cc
@@ -29,7 +29,9 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::fchmodat, int,
(int, char const *, mode_t, int));
#endif
+#if GNULIB_TEST_FSTAT
SIGNATURE_CHECK (GNULIB_NAMESPACE::fstat, int, (int, struct stat *));
+#endif
#if GNULIB_TEST_FSTATAT
SIGNATURE_CHECK (GNULIB_NAMESPACE::fstatat, int,