[lib/ChangeLog]
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 5 Oct 2006 22:49:57 +0000 (22:49 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 5 Oct 2006 22:49:57 +0000 (22:49 +0000)
Fix some Darwin-7.9.0 porting problems reported by Bruno Haible in
<http://lists.gnu.org/archive/html/bug-coreutils/2006-10/msg00063.html>.
* dirchownmod.c: Include lchown.h.
* lchown.c: Don't include files that lchown.h now includes.
Don't declare chown, since lchown.h now does that.
* lchown.h: Include errno.h, sys/types.h, unistd.h.
(lchown): Define to rpl_chown if lchown is declared but
does not exist.  Declare using a prototype if lchown is not
declared.  Add a copyright notice.
* mkstemp.h: Include <unistd.h>.
* openat.c: Include lchown.h.
[m4/ChangeLog]
* lchown.m4 (gl_FUNC_LCHOWN): Check whether lchown is declared.

lib/ChangeLog
lib/dirchownmod.c
lib/lchown.c
lib/lchown.h
lib/mkstemp.h
lib/openat.c
m4/ChangeLog
m4/lchown.m4

index bf1496a..6664787 100644 (file)
@@ -1,5 +1,17 @@
 2006-10-05  Paul Eggert  <eggert@cs.ucla.edu>
 
+       Fix some Darwin-7.9.0 porting problems reported by Bruno Haible in
+       <http://lists.gnu.org/archive/html/bug-coreutils/2006-10/msg00063.html>.
+       * dirchownmod.c: Include lchown.h.
+       * lchown.c: Don't include files that lchown.h now includes.
+       Don't declare chown, since lchown.h now does that.
+       * lchown.h: Include errno.h, sys/types.h, unistd.h.
+       (lchown): Define to rpl_chown if lchown is declared but
+       does not exist.  Declare using a prototype if lchown is not
+       declared.  Add a copyright notice.
+       * mkstemp.h: Include <unistd.h>.
+       * openat.c: Include lchown.h.
+
        * fcntl_.h (O_NOFOLLOW): Don't depend on O_NOFOLLOW_IS_INEFFECTIVE;
        we now test for that separately.
        * fts.c (fts_safe_changedir): Inspect HAVE_WORKING_O_NOFOLLOW
index 3b65446..b3e9518 100644 (file)
@@ -28,6 +28,7 @@
 #include <unistd.h>
 
 #include "lchmod.h"
+#include "lchown.h"
 #include "stat-macros.h"
 
 #ifndef HAVE_FCHMOD
index f015cde..855db8f 100644 (file)
 
 #include <config.h>
 
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-
 #include "lchown.h"
-#include "stat-macros.h"
 
-/* Declare chown to avoid a warning.  Don't include unistd.h,
-   because it may have a conflicting prototype for lchown.  */
-int chown ();
+#include "stat-macros.h"
 
 /* Work just like chown, except when FILE is a symbolic link.
    In that case, set errno to EOPNOTSUPP and return -1.
index d4824b1..6816d1f 100644 (file)
@@ -1,3 +1,36 @@
+/* Declare a replacement for lchown on hosts that lack it.
+
+   Copyright (C) 2006 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 2, 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, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* Written by Jim Meyering.  */
+
+#include <errno.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#if HAVE_DECL_LCHOWN
+# if ! HAVE_LCHOWN
+#  undef lchown
+#  define lchown rpl_chown
+# endif
+#else
+int lchown (char const *, uid_t, gid_t);
+#endif
+
 /* Some systems don't have EOPNOTSUPP.  */
 #ifndef EOPNOTSUPP
 # ifdef ENOTSUP
index 69e6fec..9ed7411 100644 (file)
@@ -19,6 +19,7 @@
 /* written by Jim Meyering */
 
 #include <stdlib.h>
+#include <unistd.h>
 
 #ifdef __MKSTEMP_PREFIX
 # define _GL_CONCAT(x, y) x ## y
index 82b4a06..7f92c7c 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
 #include "fcntl--.h"
+#include "lchown.h"
 #include "lstat.h"
 #include "openat-priv.h"
 #include "save-cwd.h"
index 814a426..1b763eb 100644 (file)
@@ -1,5 +1,7 @@
 2006-10-05  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * lchown.m4 (gl_FUNC_LCHOWN): Check whether lchown is declared.
+
        * fcntl_h.m4 (gl_FCNTL_H): Define HAVE_WORKING_O_NOFOLLOW instead
        of O_NOFOLLOW_IS_INEFFECTIVE.  Define HAVE_WORKING_O_NOATIME if
        O_NOATIME works.
index ae54522..f64dd08 100644 (file)
@@ -1,4 +1,4 @@
-#serial 9
+#serial 10
 
 dnl Copyright (C) 1998, 2001, 2003, 2004, 2005, 2006 Free Software
 dnl Foundation, Inc.
@@ -15,5 +15,6 @@ AC_DEFUN([gl_FUNC_LCHOWN],
   AC_REQUIRE([AC_TYPE_UID_T])
   AC_REQUIRE([gl_FUNC_CHOWN])
   AC_REQUIRE([gl_STAT_MACROS])
+  AC_CHECK_DECLS_ONCE([lchown])
   AC_REPLACE_FUNCS(lchown)
 ])