1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Update from Gnulib by running admin/merge-gnulib

* admin/merge-gnulib (AVOIDED_MODULES): Add chmod.
This commit is contained in:
Paul Eggert 2022-07-05 23:57:32 -05:00
parent 2be06b13dd
commit 27436451ec
16 changed files with 137 additions and 123 deletions

View file

@ -51,7 +51,7 @@ GNULIB_MODULES='
' '
AVOIDED_MODULES=' AVOIDED_MODULES='
btowc close crypto/af_alg dup fchdir fstat langinfo lock btowc chmod close crypto/af_alg dup fchdir fstat langinfo lock
mbrtowc mbsinit memchr mkdir msvc-inval msvc-nothrow nl_langinfo mbrtowc mbsinit memchr mkdir msvc-inval msvc-nothrow nl_langinfo
openat-die opendir pthread-h raise openat-die opendir pthread-h raise
save-cwd select setenv sigprocmask stat stdarg stdbool save-cwd select setenv sigprocmask stat stdarg stdbool

View file

@ -4,7 +4,7 @@
# shellcheck disable=SC2006,SC2268 # see below for rationale # shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2022-05-08' timestamp='2022-05-25'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@ -1378,8 +1378,11 @@ EOF
BePC:Haiku:*:*) # Haiku running on Intel PC compatible. BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
GUESS=i586-pc-haiku GUESS=i586-pc-haiku
;; ;;
x86_64:Haiku:*:*) ppc:Haiku:*:*) # Haiku running on Apple PowerPC
GUESS=x86_64-unknown-haiku GUESS=powerpc-apple-haiku
;;
*:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat)
GUESS=$UNAME_MACHINE-unknown-haiku
;; ;;
SX-4:SUPER-UX:*:*) SX-4:SUPER-UX:*:*)
GUESS=sx4-nec-superux$UNAME_RELEASE GUESS=sx4-nec-superux$UNAME_RELEASE

View file

@ -1,10 +1,10 @@
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright 1992-2021 Free Software Foundation, Inc. # Copyright 1992-2022 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # see below for rationale # shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2021-12-25' timestamp='2022-01-03'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@ -76,7 +76,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright 1992-2021 Free Software Foundation, Inc. Copyright 1992-2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."

View file

@ -7651,7 +7651,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% If SUBTOPIC is present, precede it with a space, and call \doind. % If SUBTOPIC is present, precede it with a space, and call \doind.
% (At some time during the 20th century, this made a two-level entry in an % (At some time during the 20th century, this made a two-level entry in an
% index such as the operation index. Nobody seemed to notice the change in % index such as the operation index. Nobody seemed to notice the change in
% behavior though.) % behaviour though.)
\def\dosubind#1#2#3{% \def\dosubind#1#2#3{%
\def\thirdarg{#3}% \def\thirdarg{#3}%
\ifx\thirdarg\empty \ifx\thirdarg\empty

View file

@ -83,9 +83,10 @@ fchmodat (int dir, char const *file, mode_t mode, int flags)
# if NEED_FCHMODAT_NONSYMLINK_FIX # if NEED_FCHMODAT_NONSYMLINK_FIX
if (flags == AT_SYMLINK_NOFOLLOW) if (flags == AT_SYMLINK_NOFOLLOW)
{ {
struct stat st; # if HAVE_READLINKAT
char readlink_buf[1];
# if defined O_PATH && defined AT_EMPTY_PATH # ifdef O_PATH
/* Open a file descriptor with O_NOFOLLOW, to make sure we don't /* Open a file descriptor with O_NOFOLLOW, to make sure we don't
follow symbolic links, if /proc is mounted. O_PATH is used to follow symbolic links, if /proc is mounted. O_PATH is used to
avoid a failure if the file is not readable. avoid a failure if the file is not readable.
@ -94,49 +95,29 @@ fchmodat (int dir, char const *file, mode_t mode, int flags)
if (fd < 0) if (fd < 0)
return fd; return fd;
/* Up to Linux 5.3 at least, when FILE refers to a symbolic link, the int err;
chmod call below will change the permissions of the symbolic link if (0 <= readlinkat (fd, "", readlink_buf, sizeof readlink_buf))
- which is undesired - and on many file systems (ext4, btrfs, jfs, err = EOPNOTSUPP;
xfs, ..., but not reiserfs) fail with error EOPNOTSUPP - which is else if (errno == EINVAL)
misleading. Therefore test for a symbolic link explicitly.
Use fstatat because fstat does not work on O_PATH descriptors
before Linux 3.6. */
if (fstatat (fd, "", &st, AT_EMPTY_PATH) != 0)
{ {
int stat_errno = errno;
close (fd);
errno = stat_errno;
return -1;
}
if (S_ISLNK (st.st_mode))
{
close (fd);
errno = EOPNOTSUPP;
return -1;
}
# if defined __linux__ || defined __ANDROID__ || defined __CYGWIN__
static char const fmt[] = "/proc/self/fd/%d"; static char const fmt[] = "/proc/self/fd/%d";
char buf[sizeof fmt - sizeof "%d" + INT_BUFSIZE_BOUND (int)]; char buf[sizeof fmt - sizeof "%d" + INT_BUFSIZE_BOUND (int)];
sprintf (buf, fmt, fd); sprintf (buf, fmt, fd);
int chmod_result = chmod (buf, mode); err = chmod (buf, mode) == 0 ? 0 : errno == ENOENT ? -1 : errno;
int chmod_errno = errno;
close (fd);
if (chmod_result == 0)
return chmod_result;
if (chmod_errno != ENOENT)
{
errno = chmod_errno;
return chmod_result;
} }
# endif else
/* /proc is not mounted or would not work as in GNU/Linux. */ err = errno == ENOENT ? -1 : errno;
# else close (fd);
int fstatat_result = fstatat (dir, file, &st, AT_SYMLINK_NOFOLLOW);
if (fstatat_result != 0) errno = err;
return fstatat_result; if (0 <= err)
if (S_ISLNK (st.st_mode)) return err == 0 ? 0 : -1;
# endif
/* O_PATH + /proc is not supported. */
if (0 <= readlinkat (dir, file, readlink_buf, sizeof readlink_buf))
{ {
errno = EOPNOTSUPP; errno = EOPNOTSUPP;
return -1; return -1;

View file

@ -29,6 +29,8 @@
/* Return the length of a prefix of S that corresponds to the suffix /* Return the length of a prefix of S that corresponds to the suffix
defined by this extended regular expression in the C locale: defined by this extended regular expression in the C locale:
(\.[A-Za-z~][A-Za-z0-9~]*)*$ (\.[A-Za-z~][A-Za-z0-9~]*)*$
Use the longest suffix matching this regular expression,
except do not use all of S as a suffix if S is nonempty.
If *LEN is -1, S is a string; set *LEN to S's length. If *LEN is -1, S is a string; set *LEN to S's length.
Otherwise, *LEN should be nonnegative, S is a char array, Otherwise, *LEN should be nonnegative, S is a char array,
and *LEN does not change. */ and *LEN does not change. */
@ -36,20 +38,22 @@ static idx_t
file_prefixlen (char const *s, ptrdiff_t *len) file_prefixlen (char const *s, ptrdiff_t *len)
{ {
size_t n = *len; /* SIZE_MAX if N == -1. */ size_t n = *len; /* SIZE_MAX if N == -1. */
idx_t prefixlen = 0;
for (idx_t i = 0; ; i++) for (idx_t i = 0; ; )
{ {
idx_t prefixlen = i;
while (i + 1 < n && s[i] == '.' && (c_isalpha (s[i + 1])
|| s[i + 1] == '~'))
for (i += 2; i < n && (c_isalnum (s[i]) || s[i] == '~'); i++)
continue;
if (*len < 0 ? !s[i] : i == n) if (*len < 0 ? !s[i] : i == n)
{ {
*len = i; *len = i;
return prefixlen; return prefixlen;
} }
i++;
prefixlen = i;
while (i + 1 < n && s[i] == '.' && (c_isalpha (s[i + 1])
|| s[i + 1] == '~'))
for (i += 2; i < n && (c_isalnum (s[i]) || s[i] == '~'); i++)
continue;
} }
} }

View file

@ -61,7 +61,9 @@
without them, using version sort without special priority; without them, using version sort without special priority;
if they do not compare equal, this comparison result is used and if they do not compare equal, this comparison result is used and
the suffixes are effectively ignored. Otherwise, the entire the suffixes are effectively ignored. Otherwise, the entire
strings are compared using version sort. strings are compared using version sort. When removing a suffix
from a nonempty string, remove the maximal-length suffix such that
the remaining string is nonempty.
This function is intended to be a replacement for strverscmp. */ This function is intended to be a replacement for strverscmp. */
int filevercmp (char const *a, char const *b) _GL_ATTRIBUTE_PURE; int filevercmp (char const *a, char const *b) _GL_ATTRIBUTE_PURE;

View file

@ -35,6 +35,7 @@
# --macro-prefix=gl \ # --macro-prefix=gl \
# --no-vc-files \ # --no-vc-files \
# --avoid=btowc \ # --avoid=btowc \
# --avoid=chmod \
# --avoid=close \ # --avoid=close \
# --avoid=crypto/af_alg \ # --avoid=crypto/af_alg \
# --avoid=dup \ # --avoid=dup \
@ -327,6 +328,7 @@ GL_GNULIB_CALLOC_GNU = @GL_GNULIB_CALLOC_GNU@
GL_GNULIB_CALLOC_POSIX = @GL_GNULIB_CALLOC_POSIX@ GL_GNULIB_CALLOC_POSIX = @GL_GNULIB_CALLOC_POSIX@
GL_GNULIB_CANONICALIZE_FILE_NAME = @GL_GNULIB_CANONICALIZE_FILE_NAME@ GL_GNULIB_CANONICALIZE_FILE_NAME = @GL_GNULIB_CANONICALIZE_FILE_NAME@
GL_GNULIB_CHDIR = @GL_GNULIB_CHDIR@ GL_GNULIB_CHDIR = @GL_GNULIB_CHDIR@
GL_GNULIB_CHMOD = @GL_GNULIB_CHMOD@
GL_GNULIB_CHOWN = @GL_GNULIB_CHOWN@ GL_GNULIB_CHOWN = @GL_GNULIB_CHOWN@
GL_GNULIB_CLOSE = @GL_GNULIB_CLOSE@ GL_GNULIB_CLOSE = @GL_GNULIB_CLOSE@
GL_GNULIB_CLOSEDIR = @GL_GNULIB_CLOSEDIR@ GL_GNULIB_CLOSEDIR = @GL_GNULIB_CLOSEDIR@
@ -1029,6 +1031,7 @@ REPLACE_ALIGNED_ALLOC = @REPLACE_ALIGNED_ALLOC@
REPLACE_CALLOC_FOR_CALLOC_GNU = @REPLACE_CALLOC_FOR_CALLOC_GNU@ REPLACE_CALLOC_FOR_CALLOC_GNU = @REPLACE_CALLOC_FOR_CALLOC_GNU@
REPLACE_CALLOC_FOR_CALLOC_POSIX = @REPLACE_CALLOC_FOR_CALLOC_POSIX@ REPLACE_CALLOC_FOR_CALLOC_POSIX = @REPLACE_CALLOC_FOR_CALLOC_POSIX@
REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@
REPLACE_CHMOD = @REPLACE_CHMOD@
REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CHOWN = @REPLACE_CHOWN@
REPLACE_CLOSE = @REPLACE_CLOSE@ REPLACE_CLOSE = @REPLACE_CLOSE@
REPLACE_CLOSEDIR = @REPLACE_CLOSEDIR@ REPLACE_CLOSEDIR = @REPLACE_CLOSEDIR@
@ -1196,6 +1199,7 @@ SETTINGS_LIBS = @SETTINGS_LIBS@
SHELL = @SHELL@ SHELL = @SHELL@
SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
SMALL_JA_DIC = @SMALL_JA_DIC@
SQLITE3_LIBS = @SQLITE3_LIBS@ SQLITE3_LIBS = @SQLITE3_LIBS@
STDALIGN_H = @STDALIGN_H@ STDALIGN_H = @STDALIGN_H@
STDDEF_H = @STDDEF_H@ STDDEF_H = @STDDEF_H@
@ -3497,6 +3501,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
-e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \ -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \
-e 's|@''WINDOWS_STAT_TIMESPEC''@|$(WINDOWS_STAT_TIMESPEC)|g' \ -e 's|@''WINDOWS_STAT_TIMESPEC''@|$(WINDOWS_STAT_TIMESPEC)|g' \
-e 's/@''GNULIB_CHMOD''@/$(GL_GNULIB_CHMOD)/g' \
-e 's/@''GNULIB_FCHMODAT''@/$(GL_GNULIB_FCHMODAT)/g' \ -e 's/@''GNULIB_FCHMODAT''@/$(GL_GNULIB_FCHMODAT)/g' \
-e 's/@''GNULIB_FSTAT''@/$(GL_GNULIB_FSTAT)/g' \ -e 's/@''GNULIB_FSTAT''@/$(GL_GNULIB_FSTAT)/g' \
-e 's/@''GNULIB_FSTATAT''@/$(GL_GNULIB_FSTATAT)/g' \ -e 's/@''GNULIB_FSTATAT''@/$(GL_GNULIB_FSTATAT)/g' \
@ -3528,6 +3533,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \ -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \
-e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \ -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \
-e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \ -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \
-e 's|@''REPLACE_CHMOD''@|$(REPLACE_CHMOD)|g' \
-e 's|@''REPLACE_FCHMODAT''@|$(REPLACE_FCHMODAT)|g' \ -e 's|@''REPLACE_FCHMODAT''@|$(REPLACE_FCHMODAT)|g' \
-e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \ -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \
-e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \ -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \

View file

@ -25,17 +25,9 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <unistd.h> #include <unistd.h>
#ifdef __osf__
/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
eliminates this include because of the preliminary #include <sys/stat.h>
above. */
# include "sys/stat.h"
#else
# include <sys/stat.h>
#endif
#include <intprops.h> #include <intprops.h>
/* Work like chmod, except when FILE is a symbolic link. /* Work like chmod, except when FILE is a symbolic link.
@ -45,7 +37,9 @@
int int
lchmod (char const *file, mode_t mode) lchmod (char const *file, mode_t mode)
{ {
#if defined O_PATH && defined AT_EMPTY_PATH char readlink_buf[1];
#ifdef O_PATH
/* Open a file descriptor with O_NOFOLLOW, to make sure we don't /* Open a file descriptor with O_NOFOLLOW, to make sure we don't
follow symbolic links, if /proc is mounted. O_PATH is used to follow symbolic links, if /proc is mounted. O_PATH is used to
avoid a failure if the file is not readable. avoid a failure if the file is not readable.
@ -54,56 +48,46 @@ lchmod (char const *file, mode_t mode)
if (fd < 0) if (fd < 0)
return fd; return fd;
/* Up to Linux 5.3 at least, when FILE refers to a symbolic link, the int err;
chmod call below will change the permissions of the symbolic link if (0 <= readlinkat (fd, "", readlink_buf, sizeof readlink_buf))
- which is undesired - and on many file systems (ext4, btrfs, jfs, err = EOPNOTSUPP;
xfs, ..., but not reiserfs) fail with error EOPNOTSUPP - which is else if (errno == EINVAL)
misleading. Therefore test for a symbolic link explicitly.
Use fstatat because fstat does not work on O_PATH descriptors
before Linux 3.6. */
struct stat st;
if (fstatat (fd, "", &st, AT_EMPTY_PATH) != 0)
{ {
int stat_errno = errno;
close (fd);
errno = stat_errno;
return -1;
}
if (S_ISLNK (st.st_mode))
{
close (fd);
errno = EOPNOTSUPP;
return -1;
}
# if defined __linux__ || defined __ANDROID__ || defined __CYGWIN__
static char const fmt[] = "/proc/self/fd/%d"; static char const fmt[] = "/proc/self/fd/%d";
char buf[sizeof fmt - sizeof "%d" + INT_BUFSIZE_BOUND (int)]; char buf[sizeof fmt - sizeof "%d" + INT_BUFSIZE_BOUND (int)];
sprintf (buf, fmt, fd); sprintf (buf, fmt, fd);
int chmod_result = chmod (buf, mode); err = chmod (buf, mode) == 0 ? 0 : errno == ENOENT ? -1 : errno;
int chmod_errno = errno;
close (fd);
if (chmod_result == 0)
return chmod_result;
if (chmod_errno != ENOENT)
{
errno = chmod_errno;
return chmod_result;
} }
# endif else
/* /proc is not mounted or would not work as in GNU/Linux. */ err = errno == ENOENT ? -1 : errno;
#elif HAVE_LSTAT close (fd);
errno = err;
if (0 <= err)
return err == 0 ? 0 : -1;
#endif
size_t len = strlen (file);
if (len && file[len - 1] == '/')
{
struct stat st; struct stat st;
int lstat_result = lstat (file, &st); if (lstat (file, &st) < 0)
if (lstat_result != 0) return -1;
return lstat_result; if (!S_ISDIR (st.st_mode))
if (S_ISLNK (st.st_mode)) {
errno = ENOTDIR;
return -1;
}
}
/* O_PATH + /proc is not supported. */
if (0 <= readlink (file, readlink_buf, sizeof readlink_buf))
{ {
errno = EOPNOTSUPP; errno = EOPNOTSUPP;
return -1; return -1;
} }
#endif
/* Fall back on chmod, despite a possible race. */ /* Fall back on chmod, despite a possible race. */
return chmod (file, mode); return chmod (file, mode);

View file

@ -8,7 +8,7 @@ The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of either: it under the terms of either:
* the GNU Lesser General Public License as published by the Free * the GNU Lesser General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your Software Foundation; either version 3 of the License, or (at your
option) any later version. option) any later version.
or or

View file

@ -231,7 +231,7 @@ critical_factorization (const unsigned char *needle, size_t needle_len,
most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching. most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching.
If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 * If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching. */ HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching. */
static RETURN_TYPE static RETURN_TYPE _GL_ATTRIBUTE_PURE
two_way_short_needle (const unsigned char *haystack, size_t haystack_len, two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
const unsigned char *needle, size_t needle_len) const unsigned char *needle, size_t needle_len)
{ {
@ -325,7 +325,7 @@ two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 * If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, and HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, and
sublinear performance is not possible. */ sublinear performance is not possible. */
static RETURN_TYPE static RETURN_TYPE _GL_ATTRIBUTE_PURE
two_way_long_needle (const unsigned char *haystack, size_t haystack_len, two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
const unsigned char *needle, size_t needle_len) const unsigned char *needle, size_t needle_len)
{ {

View file

@ -122,8 +122,12 @@ _GL_EXTERN_C void rpl_free (void *);
# undef _GL_ATTRIBUTE_DEALLOC_FREE # undef _GL_ATTRIBUTE_DEALLOC_FREE
# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
# else # else
# if defined _MSC_VER # if defined _MSC_VER && !defined free
_GL_EXTERN_C void __cdecl free (void *); _GL_EXTERN_C
# if defined _DLL
__declspec (dllimport)
# endif
void __cdecl free (void *);
# else # else
# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
_GL_EXTERN_C void free (void *) throw (); _GL_EXTERN_C void free (void *) throw ();
@ -133,8 +137,12 @@ _GL_EXTERN_C void free (void *);
# endif # endif
# endif # endif
#else #else
# if defined _MSC_VER # if defined _MSC_VER && !defined free
_GL_EXTERN_C void __cdecl free (void *); _GL_EXTERN_C
# if defined _DLL
__declspec (dllimport)
# endif
void __cdecl free (void *);
# else # else
# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
_GL_EXTERN_C void free (void *) throw (); _GL_EXTERN_C void free (void *) throw ();

View file

@ -391,7 +391,33 @@ struct stat
#endif #endif
#if @GNULIB_MDA_CHMOD@ #if @GNULIB_CHMOD@
# if @REPLACE_CHMOD@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef chmod
# define chmod rpl_chmod
# endif
_GL_FUNCDECL_RPL (chmod, int, (const char *filename, mode_t mode)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (chmod, int, (const char *filename, mode_t mode));
# elif defined _WIN32 && !defined __CYGWIN__
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef chmod
# define chmod _chmod
# endif
/* Need to cast, because in mingw the last argument is 'int mode'. */
_GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode));
# else
_GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode));
# endif
_GL_CXXALIASWARN (chmod);
#elif defined GNULIB_POSIXCHECK
# undef chmod
# if HAVE_RAW_DECL_CHMOD
_GL_WARN_ON_USE (chmod, "chmod has portability problems - "
"use gnulib module chmod for portability");
# endif
#elif @GNULIB_MDA_CHMOD@
/* On native Windows, map 'chmod' to '_chmod', so that -loldnames is not /* On native Windows, map 'chmod' to '_chmod', so that -loldnames is not
required. In C++ with GNULIB_NAMESPACE, avoid differences between required. In C++ with GNULIB_NAMESPACE, avoid differences between
platforms by defining GNULIB_NAMESPACE::chmod always. */ platforms by defining GNULIB_NAMESPACE::chmod always. */

View file

@ -1,4 +1,4 @@
# fchmodat.m4 serial 6 # fchmodat.m4 serial 7
dnl Copyright (C) 2004-2022 Free Software Foundation, Inc. dnl Copyright (C) 2004-2022 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -97,6 +97,6 @@ AC_DEFUN([gl_FUNC_FCHMODAT],
# Prerequisites of lib/fchmodat.c. # Prerequisites of lib/fchmodat.c.
AC_DEFUN([gl_PREREQ_FCHMODAT], AC_DEFUN([gl_PREREQ_FCHMODAT],
[ [
AC_CHECK_FUNCS_ONCE([lchmod]) AC_CHECK_FUNCS_ONCE([readlinkat])
: :
]) ])

View file

@ -1,4 +1,4 @@
#serial 8 #serial 10
dnl Copyright (C) 2005-2006, 2008-2022 Free Software Foundation, Inc. dnl Copyright (C) 2005-2006, 2008-2022 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
@ -15,9 +15,7 @@ AC_DEFUN([gl_FUNC_LCHMOD],
dnl Persuade glibc <sys/stat.h> to declare lchmod(). dnl Persuade glibc <sys/stat.h> to declare lchmod().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_FUNCS_ONCE([lchmod])
AC_CHECK_FUNCS_ONCE([lchmod lstat])
if test "$ac_cv_func_lchmod" = no; then if test "$ac_cv_func_lchmod" = no; then
HAVE_LCHMOD=0 HAVE_LCHMOD=0
fi fi

View file

@ -1,4 +1,4 @@
# sys_stat_h.m4 serial 41 -*- Autoconf -*- # sys_stat_h.m4 serial 42 -*- Autoconf -*-
dnl Copyright (C) 2006-2022 Free Software Foundation, Inc. dnl Copyright (C) 2006-2022 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -46,7 +46,7 @@ AC_DEFUN_ONCE([gl_SYS_STAT_H],
dnl Check for declarations of anything we want to poison if the dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use. dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h> gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
]], [fchmodat fstat fstatat futimens getumask lchmod lstat ]], [chmod fchmodat fstat fstatat futimens getumask lchmod lstat
mkdirat mkfifo mkfifoat mknod mknodat stat utimensat]) mkdirat mkfifo mkfifoat mknod mknodat stat utimensat])
AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([AC_C_RESTRICT])
@ -72,6 +72,7 @@ AC_DEFUN([gl_SYS_STAT_H_REQUIRE_DEFAULTS],
[ [
m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS], [
gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHMOD])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHMODAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHMODAT])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTAT])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTATAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTATAT])
@ -112,6 +113,7 @@ AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD]) HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD])
HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT]) HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT])
HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT]) HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT])
REPLACE_CHMOD=0; AC_SUBST([REPLACE_CHMOD])
REPLACE_FCHMODAT=0; AC_SUBST([REPLACE_FCHMODAT]) REPLACE_FCHMODAT=0; AC_SUBST([REPLACE_FCHMODAT])
REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT]) REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT])
REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT]) REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT])