* m4/mkdir-p.m4 (gl_MKDIR_PARENTS): Test whether fchown exists.
* lib/dirchownmod.c (fchown): Define to a fallback if the system does
not have fchown.
(dirchownmod): Test HAVE_FCHOWN.
+2024-08-27 Bruno Haible <bruno@clisp.org>
+
+ mkdir-p: Don't reference an undefined function on native Windows.
+ * m4/mkdir-p.m4 (gl_MKDIR_PARENTS): Test whether fchown exists.
+ * lib/dirchownmod.c (fchown): Define to a fallback if the system does
+ not have fchown.
+ (dirchownmod): Test HAVE_FCHOWN.
+
2024-08-27 Bruno Haible <bruno@clisp.org>
fts: Don't assume that a pointer is as wide as a 'long'.
# define fchmod(fd, mode) (-1)
#endif
+#ifndef HAVE_FCHOWN
+# define HAVE_FCHOWN 0
+# undef fchown
+# define fchown(fd, owner, group) (-1)
+#endif
+
/* Change the ownership and mode bits of a directory. If FD is
nonnegative, it should be a file descriptor associated with the
directory; close it before returning. DIR is the name of the
if ((owner != (uid_t) -1 && owner != st.st_uid)
|| (group != (gid_t) -1 && group != st.st_gid))
{
- result = (0 <= fd
+ result = (HAVE_FCHOWN && 0 <= fd
? fchown (fd, owner, group)
: mkdir_mode != (mode_t) -1
? lchown (dir, owner, group)
-# mkdir-p.m4 serial 15
+# mkdir-p.m4 serial 16
dnl Copyright (C) 2002-2006, 2009-2024 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_MKDIR_PARENTS],
[
dnl Prerequisites of lib/dirchownmod.c.
- AC_CHECK_FUNCS_ONCE([fchmod])
+ AC_CHECK_FUNCS_ONCE([fchmod fchown])
])