changeset 7173:0dfc3e6e50d2

BeOS portability. * lib/dirchownmod.c (dirchownmod): Don't use fchmod if it doesn't exist. * m4/mkdir-p.m4 (gl_MKDIR_PARENTS): Check for fchmod.
author Paul Eggert <eggert@cs.ucla.edu>
date Mon, 21 Aug 2006 22:05:23 +0000
parents be9e01d008cb
children 8e4f38b58077
files lib/ChangeLog lib/dirchownmod.c m4/ChangeLog m4/mkdir-p.m4
diffstat 4 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -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.
--- a/lib/dirchownmod.c
+++ b/lib/dirchownmod.c
@@ -40,6 +40,12 @@
 # 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 @@
 	    {
 	      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)
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -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.
 
--- a/m4/mkdir-p.m4
+++ b/m4/mkdir-p.m4
@@ -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 @@
   dnl Prerequisites of lib/dirchownmod.c.
   AC_REQUIRE([gl_FUNC_LCHMOD])
   AC_REQUIRE([gl_FUNC_LCHOWN])
+  AC_CHECK_FUNCS_ONCE([fchmod])
 ])