BeOS portability.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 21 Aug 2006 22:05:23 +0000 (22:05 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 21 Aug 2006 22:05:23 +0000 (22:05 +0000)
* lib/dirchownmod.c (dirchownmod): Don't use fchmod if it doesn't exist.
* m4/mkdir-p.m4 (gl_MKDIR_PARENTS): Check for fchmod.

lib/ChangeLog
lib/dirchownmod.c
m4/ChangeLog
m4/mkdir-p.m4

index 5705f2a..609336f 100644 (file)
@@ -1,4 +1,10 @@
-2006-08-19  Bruno Haible  <bruno@clisp.org>
+2006-08-21  Paul Eggert  <eggert@cs.ucla.edu>
+
+       BeOS portability.
+       * dirchownmod.c (dirchownmod): Don't use fchmod if it doesn't exist.
+       Problem reported by Bruno Haible.
+
+2006-08-21  Bruno Haible  <bruno@clisp.org>
 
        BeOS portability.
        * mbchar.h: Include <wctype.h> only if it exists.
index 50e5fe1..4c76d59 100644 (file)
 # define O_NOFOLLOW 0
 #endif
 
+#ifndef HAVE_FCHMOD
+# define HAVE_FCHMOD 0
+# undef fchmod
+# define fchmod(fd, mode) (-1)
+#endif
+
 /* Change the ownership and mode bits of the directory DIR.
 
    If MKDIR_MODE is not (mode_t) -1, mkdir (DIR, MKDIR_MODE) has just
@@ -134,7 +140,7 @@ dirchownmod (char const *dir, mode_t mkdir_mode,
            {
              mode_t chmod_mode =
                mode | (dir_mode & CHMOD_MODE_BITS & ~mode_bits);
-             result = (0 <= fd
+             result = (HAVE_FCHMOD && 0 <= fd
                        ? fchmod (fd, chmod_mode)
                        : mkdir_mode != (mode_t) -1
                        ? lchmod (dir, chmod_mode)
index 7813a7a..41d7152 100644 (file)
@@ -1,5 +1,7 @@
 2006-08-21  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * mkdir-p.m4 (gl_MKDIR_PARENTS): Check for fchmod.
+
        * argmatch.m4: New file, from coreutils with AC_LIBSOURCES removed.
        * dev-ino.m4, same-inode.m4: Remove.
 
index 9317fa4..8f1e48d 100644 (file)
@@ -1,4 +1,4 @@
-# mkdir-p.m4 serial 12
+# mkdir-p.m4 serial 13
 dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -12,4 +12,5 @@ AC_DEFUN([gl_MKDIR_PARENTS],
   dnl Prerequisites of lib/dirchownmod.c.
   AC_REQUIRE([gl_FUNC_LCHMOD])
   AC_REQUIRE([gl_FUNC_LCHOWN])
+  AC_CHECK_FUNCS_ONCE([fchmod])
 ])