[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: coreutils-6.0 on BeOS (3)
From: |
Paul Eggert |
Subject: |
Re: coreutils-6.0 on BeOS (3) |
Date: |
Mon, 21 Aug 2006 15:07:33 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Bruno Haible <address@hidden> writes:
> ! #if HAVE_FCHMOD
> ! if (0 <= fd)
> ! result = fchmod (fd, chmod_mode);
> ! else
> ! #endif
Thanks for the report and fix. A couple of things: first, I prefer to
avoid #if in C functions when it's easy. Also, we need to define
HAVE_FCHMOD when fchmod is available. So I installed the following
instead.
You already fixed part (2) for BeOS; thanks. I'll let Jim look at
part (1) since that's more in his area of expertise.
2006-08-21 Paul Eggert <address@hidden>
BeOS portability.
* lib/dirchownmod.c (dirchownmod): Don't use fchmod if it doesn't exist.
Problem reported by Bruno Haible.
* m4/mkdir-p.m4 (gl_MKDIR_PARENTS): Check for fchmod.
--- lib/dirchownmod.c 17 Jul 2006 06:06:48 -0000 1.1
+++ lib/dirchownmod.c 21 Aug 2006 21:58:13 -0000
@@ -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 @@ dirchownmod (char const *dir, mode_t mkd
{
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)
--- m4/mkdir-p.m4 21 Aug 2006 21:46:31 -0000 1.5
+++ m4/mkdir-p.m4 21 Aug 2006 21:58:13 -0000
@@ -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])
])