+2008-10-20 Bruno Haible <bruno@clisp.org>
+
+ * lib/fts.c: Don't include lstat.h.
+ * lib/openat.c: Include <sys/stat.h> instead of lstat.h.
+
+ Move the lstat() declaration to <sys/stat.h>.
+ * lib/lstat.h: Remove file.
+ * lib/sys_stat.in.h: Add special invocation convention.
+ (lstat): New declaration.
+ * lib/lstat.c (orig_lstat): New function.
+ (rpl_lstat): Use orig_lstat instead of lstat.
+ * m4/lstat.m4 (gl_FUNC_LSTAT): Require gl_SYS_STAT_H_DEFAULTS and
+ AC_C_INLINE. Set REPLACE_LSTAT.
+ * m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Initialize GNULIB_LSTAT
+ and REPLACE_LSTAT.
+ * modules/lstat (Files): Remove lib/lstat.h.
+ (configure.ac): Invoke gl_SYS_STAT_MODULE_INDICATOR.
+ (Include): Specify <sys/stat.h> instead of lstat.h.
+ * modules/sys_stat (Makefile.am): Substitute GNULIB_LSTAT and
+ REPLACE_LSTAT.
+ * NEWS: Mention the change.
+
2008-10-20 Bruno Haible <bruno@clisp.org>
* modules/posix_spawn-tests: New file.
Date Modules Changes
+2008-10-20 lstat The include file is changed from "lstat.h" to
+ <sys/stat.h>.
+
2008-10-20 getaddrinfo The include file is changed from "getaddrinfo.h"
to <netdb.h>.
#if ! _LIBC
# include "fcntl--.h"
-# include "lstat.h"
# include "openat.h"
# include "unistd--.h"
# include "same-inode.h"
/* Work around a bug of lstat on some systems
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free
- Software Foundation, Inc.
+ Copyright (C) 1997-1999, 2000-2006, 2008 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
#include <config.h>
-/* The specification of these functions is in sys_stat.h. But we cannot
- include this include file here, because on some systems, a
- "#define lstat lstat64" is being used, and sys_stat.h deletes this
- definition. */
-
+/* Get the original definition of open. It might be defined as a macro. */
+#define __need_system_sys_stat_h
#include <sys/types.h>
#include <sys/stat.h>
+#undef __need_system_sys_stat_h
+
+static inline int
+orig_lstat (const char *filename, struct stat *buf)
+{
+ return lstat (filename, buf);
+}
+
+/* Specification. */
+#include <sys/stat.h>
+
#include <string.h>
#include <errno.h>
rpl_lstat (const char *file, struct stat *sbuf)
{
size_t len;
- int lstat_result = lstat (file, sbuf);
+ int lstat_result = orig_lstat (file, sbuf);
if (lstat_result != 0 || !S_ISLNK (sbuf->st_mode))
return lstat_result;
+++ /dev/null
-/* Retrieving information about files.
- Copyright (C) 2005 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/>. */
-
-#include <sys/stat.h>
-
-#if !LSTAT_FOLLOWS_SLASHED_SYMLINK
-extern int rpl_lstat (const char *name, struct stat *buf);
-# undef lstat
-# define lstat rpl_lstat
-#endif
/* provide a replacement openat function
- Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006, 2007, 2008 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
#include <stdarg.h>
#include <stddef.h>
+#include <sys/stat.h>
#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
#include "fcntl--.h"
-#include "lstat.h"
#include "openat-priv.h"
#include "save-cwd.h"
incomplete. It is intended to provide definitions and prototypes
needed by an application. Start with what the system provides. */
-#ifndef _GL_SYS_STAT_H
-
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+#if defined __need_system_sys_stat_h
+/* Special invocation convention. */
+
+#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
+
+#else
+/* Normal invocation convention. */
+
+#ifndef _GL_SYS_STAT_H
+
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
#if ! @HAVE_LSTAT@
# define lstat stat
#endif
+#if @GNULIB_LSTAT@ && @REPLACE_LSTAT@
+# undef lstat
+# define lstat rpl_lstat
+extern int rpl_lstat (const char *name, struct stat *buf);
+#endif
+
#if @REPLACE_MKDIR@
# undef mkdir
#endif /* _GL_SYS_STAT_H */
#endif /* _GL_SYS_STAT_H */
+#endif
-#serial 16
+#serial 17
-# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007
+# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
AC_DEFUN([gl_FUNC_LSTAT],
[
+ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
dnl Note: AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK does AC_LIBOBJ(lstat).
+ if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then
+ REPLACE_LSTAT=1
+ fi
+ # Prerequisites of lib/lstat.c.
+ AC_REQUIRE([AC_C_INLINE])
:
])
-# sys_stat_h.m4 serial 9 -*- Autoconf -*-
+# sys_stat_h.m4 serial 10 -*- Autoconf -*-
dnl Copyright (C) 2006-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,
AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
[
GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
+ GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD])
+ REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT])
REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
])
Files:
lib/lstat.c
-lib/lstat.h
m4/lstat.m4
Depends-on:
configure.ac:
gl_FUNC_LSTAT
+gl_SYS_STAT_MODULE_INDICATOR([lstat])
Makefile.am:
Include:
-"lstat.h"
+<sys/stat.h>
License:
LGPL
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
-e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \
+ -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \
-e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \
-e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
+ -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \
-e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/sys_stat.in.h; \