+2008-10-18 Bruno Haible <bruno@clisp.org>
+
+ * lib/dirchownmod.c: Don't include lchmod.h.
+
+ Move the lchmod() declaration to <sys/stat.h>.
+ * lib/lchmod.h: Remove file.
+ * lib/sys_stat.in.h: Add placeholder for GL_LINK_WARNING.
+ (lchmod): New declaration, moved here from lib/lchown.h.
+ * m4/lchmod.m4 (gl_FUNC_LCHMOD): Require gl_SYS_STAT_H_DEFAULTS and
+ AC_USE_SYSTEM_EXTENSIONS. Set HAVE_LCHMOD.
+ * m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Initialize GNULIB_LCHMOD
+ and HAVE_LCHMOD.
+ * modules/lchmod (Files): Remove lib/lchmod.h.
+ (Depends-on): Add sys_stat, extensions.
+ (configure.ac): Invoke gl_SYS_STAT_MODULE_INDICATOR.
+ (Include): Specify <sys/stat.h> instead of lchmod.h.
+ * modules/sys_stat (Depends-on): Add link-warning.
+ (Makefile.am): Substitute GNULIB_LCHMOD, HAVE_LCHMOD, and the
+ definition of GL_LINK_WARNING.
+ * NEWS: Mention the change.
+
2008-10-18 Bruno Haible <bruno@clisp.org>
* lib/fchdir.c: Don't include dirfd.h.
Date Modules Changes
+2008-10-18 lchmod The include file is changed from "lchmod.h" to
+ <sys/stat.h>.
+
2008-10-18 dirfd The include file is changed from "dirfd.h" to
<dirent.h>.
/* Change the ownership and mode bits of a directory.
- Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 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 <sys/stat.h>
#include <unistd.h>
-#include "lchmod.h"
#include "stat-macros.h"
#ifndef HAVE_FCHMOD
+++ /dev/null
-/* Provide a replacement for lchmod on hosts that lack it.
-
- 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/>. */
-
-/* Written by Paul Eggert. */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#ifndef HAVE_LCHMOD
-
-/* The lchmod replacement follows symbolic links. Callers should take
- this into account; lchmod should be applied only to arguments that
- are known to not be symbolic links. On hosts that lack lchmod,
- this can lead to race conditions between the check and the
- invocation of lchmod, but we know of no workarounds that are
- reliable in general. You might try requesting support for lchmod
- from your operating system supplier. */
-
-# define lchmod chmod
-#endif
/* Provide a more complete sys/stat header file.
- Copyright (C) 2006-2008 Free Software Foundation, Inc.
+ Copyright (C) 2005-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
#ifndef _GL_SYS_STAT_H
#define _GL_SYS_STAT_H
+/* The definition of GL_LINK_WARNING is copied here. */
+
/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
headers that may declare mkdir(). */
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# endif
#endif
+
+/* Declare BSD extensions. */
+
+#if @GNULIB_LCHMOD@
+/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
+ denotes a symbolic link. */
+# if !@HAVE_LCHMOD@
+/* The lchmod replacement follows symbolic links. Callers should take
+ this into account; lchmod should be applied only to arguments that
+ are known to not be symbolic links. On hosts that lack lchmod,
+ this can lead to race conditions between the check and the
+ invocation of lchmod, but we know of no workarounds that are
+ reliable in general. You might try requesting support for lchmod
+ from your operating system supplier. */
+# define lchmod chmod
+# endif
+# if 0 /* assume already declared */
+extern int lchmod (const char *filename, mode_t mode);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef lchmod
+# define lchmod(f,m) \
+ (GL_LINK_WARNING ("lchmod is unportable - " \
+ "use gnulib module lchmod for portability"), \
+ lchmod (f, m))
+#endif
+
#endif /* _GL_SYS_STAT_H */
#endif /* _GL_SYS_STAT_H */
-#serial 2
+#serial 3
-dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 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,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_LCHMOD],
[
+ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+
+ dnl Persuade glibc <sys/stat.h> to declare lchmod().
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
AC_CHECK_FUNCS_ONCE([lchmod])
+ if test $ac_cv_func_lchmod = no; then
+ HAVE_LCHMOD=0
+ fi
])
-# sys_stat_h.m4 serial 8 -*- Autoconf -*-
+# sys_stat_h.m4 serial 9 -*- 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])
dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD])
REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
])
lchmod that is actually chmod (!) on hosts lacking lchmod
Files:
-lib/lchmod.h
m4/lchmod.m4
Depends-on:
+sys_stat
+extensions
configure.ac:
gl_FUNC_LCHMOD
+gl_SYS_STAT_MODULE_INDICATOR([lchmod])
Makefile.am:
Include:
-"lchmod.h"
+<sys/stat.h>
License:
GPL
Depends-on:
include_next
+link-warning
configure.ac:
gl_HEADER_SYS_STAT_H
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-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|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \
-e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
-e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \
+ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/sys_stat.in.h; \
} > $@-t
mv $@-t $@