Update from Gnulib by running admin/merge-gnulib

This commit is contained in:
Paul Eggert 2025-01-15 19:31:07 -08:00
parent 4f946a6522
commit 74dc2bd280
11 changed files with 174 additions and 71 deletions

View file

@ -369,8 +369,12 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
# define O_RSYNC 0 # define O_RSYNC 0
#endif #endif
#if defined O_SEARCH && defined O_PATH && O_SEARCH == O_PATH
# undef O_SEARCH /* musl mistakenly #defines O_SEARCH to O_PATH. */
#endif
#ifndef O_SEARCH #ifndef O_SEARCH
# define O_SEARCH O_RDONLY /* This is often close enough in older systems. */ # define O_SEARCH O_RDONLY /* Often close enough in non-POSIX systems. */
#endif #endif
#ifndef O_SYNC #ifndef O_SYNC

View file

@ -99,6 +99,36 @@ enum {
ACE4_IDENTIFIER_GROUP = 0x00000040 ACE4_IDENTIFIER_GROUP = 0x00000040
}; };
/* AI indicates XATTR may be present but wasn't accessible.
This is the case when [l]listxattr failed with E2BIG,
or failed with EACCES which in Linux kernel 6.12 NFS can mean merely
that we lack read access.
*/
static bool
aclinfo_may_indicate_xattr (struct aclinfo const *ai)
{
return ai->size < 0 && (ai->u.err == EACCES || ai->u.err == E2BIG);
}
/* Does NAME have XATTR? */
static bool
has_xattr (char const *xattr, struct aclinfo const *ai,
MAYBE_UNUSED char const *restrict name, MAYBE_UNUSED int flags)
{
if (ai && aclinfo_has_xattr (ai, xattr))
return true;
else if (!ai || aclinfo_may_indicate_xattr (ai))
{
int ret = ((flags & ACL_SYMLINK_FOLLOW ? getxattr : lgetxattr)
(name, xattr, NULL, 0));
if (0 <= ret || (errno == ERANGE || errno == E2BIG))
return true;
}
return false;
}
/* Does AI's xattr set contain XATTR? */ /* Does AI's xattr set contain XATTR? */
bool bool
@ -176,11 +206,13 @@ get_aclinfo (char const *name, struct aclinfo *ai, int flags)
} }
} }
if (0 < ai->size && flags & ACL_GET_SCONTEXT) /* A security context can exist only if extended attributes do. */
if (flags & ACL_GET_SCONTEXT
&& (0 < ai->size || aclinfo_may_indicate_xattr (ai)))
{ {
if (is_smack_enabled ()) if (is_smack_enabled ())
{ {
if (aclinfo_has_xattr (ai, XATTR_NAME_SMACK)) if (ai->size < 0 || aclinfo_has_xattr (ai, XATTR_NAME_SMACK))
{ {
ssize_t r = smack_new_label_from_path (name, "security.SMACK64", ssize_t r = smack_new_label_from_path (name, "security.SMACK64",
flags & ACL_SYMLINK_FOLLOW, flags & ACL_SYMLINK_FOLLOW,
@ -191,7 +223,7 @@ get_aclinfo (char const *name, struct aclinfo *ai, int flags)
else else
{ {
# if USE_SELINUX_SELINUX_H # if USE_SELINUX_SELINUX_H
if (aclinfo_has_xattr (ai, XATTR_NAME_SELINUX)) if (ai->size < 0 || aclinfo_has_xattr (ai, XATTR_NAME_SELINUX))
{ {
ssize_t r = ssize_t r =
((flags & ACL_SYMLINK_FOLLOW ? getfilecon : lgetfilecon) ((flags & ACL_SYMLINK_FOLLOW ? getfilecon : lgetfilecon)
@ -352,7 +384,7 @@ file_has_aclinfo (MAYBE_UNUSED char const *restrict name,
int initial_errno = errno; int initial_errno = errno;
get_aclinfo (name, ai, flags); get_aclinfo (name, ai, flags);
if (ai->size <= 0) if (!aclinfo_may_indicate_xattr (ai) && ai->size <= 0)
{ {
errno = ai->size < 0 ? ai->u.err : initial_errno; errno = ai->size < 0 ? ai->u.err : initial_errno;
return ai->size; return ai->size;
@ -363,11 +395,11 @@ file_has_aclinfo (MAYBE_UNUSED char const *restrict name,
In earlier Fedora the two types of ACLs were mutually exclusive. In earlier Fedora the two types of ACLs were mutually exclusive.
Attempt to work correctly on both kinds of systems. */ Attempt to work correctly on both kinds of systems. */
if (!aclinfo_has_xattr (ai, XATTR_NAME_NFSV4_ACL)) if (!has_xattr (XATTR_NAME_NFSV4_ACL, ai, name, flags))
return return
(aclinfo_has_xattr (ai, XATTR_NAME_POSIX_ACL_ACCESS) (has_xattr (XATTR_NAME_POSIX_ACL_ACCESS, ai, name, flags)
|| ((d_type == DT_DIR || d_type == DT_UNKNOWN) || ((d_type == DT_DIR || d_type == DT_UNKNOWN)
&& aclinfo_has_xattr (ai, XATTR_NAME_POSIX_ACL_DEFAULT))); && has_xattr (XATTR_NAME_POSIX_ACL_DEFAULT, ai, name, flags)));
/* A buffer large enough to hold any trivial NFSv4 ACL. /* A buffer large enough to hold any trivial NFSv4 ACL.
The max length of a trivial NFSv4 ACL is 6 words for owner, The max length of a trivial NFSv4 ACL is 6 words for owner,

View file

@ -489,6 +489,8 @@ GL_GNULIB_MBSSPN = @GL_GNULIB_MBSSPN@
GL_GNULIB_MBSSTR = @GL_GNULIB_MBSSTR@ GL_GNULIB_MBSSTR = @GL_GNULIB_MBSSTR@
GL_GNULIB_MBSTOK_R = @GL_GNULIB_MBSTOK_R@ GL_GNULIB_MBSTOK_R = @GL_GNULIB_MBSTOK_R@
GL_GNULIB_MBSTOWCS = @GL_GNULIB_MBSTOWCS@ GL_GNULIB_MBSTOWCS = @GL_GNULIB_MBSTOWCS@
GL_GNULIB_MBS_ENDSWITH = @GL_GNULIB_MBS_ENDSWITH@
GL_GNULIB_MBS_STARTSWITH = @GL_GNULIB_MBS_STARTSWITH@
GL_GNULIB_MBTOWC = @GL_GNULIB_MBTOWC@ GL_GNULIB_MBTOWC = @GL_GNULIB_MBTOWC@
GL_GNULIB_MDA_ACCESS = @GL_GNULIB_MDA_ACCESS@ GL_GNULIB_MDA_ACCESS = @GL_GNULIB_MDA_ACCESS@
GL_GNULIB_MDA_CHDIR = @GL_GNULIB_MDA_CHDIR@ GL_GNULIB_MDA_CHDIR = @GL_GNULIB_MDA_CHDIR@
@ -642,6 +644,8 @@ GL_GNULIB_STRTOUL = @GL_GNULIB_STRTOUL@
GL_GNULIB_STRTOULL = @GL_GNULIB_STRTOULL@ GL_GNULIB_STRTOULL = @GL_GNULIB_STRTOULL@
GL_GNULIB_STRTOUMAX = @GL_GNULIB_STRTOUMAX@ GL_GNULIB_STRTOUMAX = @GL_GNULIB_STRTOUMAX@
GL_GNULIB_STRVERSCMP = @GL_GNULIB_STRVERSCMP@ GL_GNULIB_STRVERSCMP = @GL_GNULIB_STRVERSCMP@
GL_GNULIB_STR_ENDSWITH = @GL_GNULIB_STR_ENDSWITH@
GL_GNULIB_STR_STARTSWITH = @GL_GNULIB_STR_STARTSWITH@
GL_GNULIB_SYMLINK = @GL_GNULIB_SYMLINK@ GL_GNULIB_SYMLINK = @GL_GNULIB_SYMLINK@
GL_GNULIB_SYMLINKAT = @GL_GNULIB_SYMLINKAT@ GL_GNULIB_SYMLINKAT = @GL_GNULIB_SYMLINKAT@
GL_GNULIB_SYSTEM_POSIX = @GL_GNULIB_SYSTEM_POSIX@ GL_GNULIB_SYSTEM_POSIX = @GL_GNULIB_SYSTEM_POSIX@
@ -3655,6 +3659,8 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's/@''GNULIB_MBSSPN''@/$(GL_GNULIB_MBSSPN)/g' \ -e 's/@''GNULIB_MBSSPN''@/$(GL_GNULIB_MBSSPN)/g' \
-e 's/@''GNULIB_MBSSEP''@/$(GL_GNULIB_MBSSEP)/g' \ -e 's/@''GNULIB_MBSSEP''@/$(GL_GNULIB_MBSSEP)/g' \
-e 's/@''GNULIB_MBSTOK_R''@/$(GL_GNULIB_MBSTOK_R)/g' \ -e 's/@''GNULIB_MBSTOK_R''@/$(GL_GNULIB_MBSTOK_R)/g' \
-e 's/@''GNULIB_MBS_ENDSWITH''@/$(GL_GNULIB_MBS_ENDSWITH)/g' \
-e 's/@''GNULIB_MBS_STARTSWITH''@/$(GL_GNULIB_MBS_STARTSWITH)/g' \
-e 's/@''GNULIB_MEMCHR''@/$(GL_GNULIB_MEMCHR)/g' \ -e 's/@''GNULIB_MEMCHR''@/$(GL_GNULIB_MEMCHR)/g' \
-e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \ -e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \
-e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \ -e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \
@ -3673,6 +3679,8 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's/@''GNULIB_STRSTR''@/$(GL_GNULIB_STRSTR)/g' \ -e 's/@''GNULIB_STRSTR''@/$(GL_GNULIB_STRSTR)/g' \
-e 's/@''GNULIB_STRCASESTR''@/$(GL_GNULIB_STRCASESTR)/g' \ -e 's/@''GNULIB_STRCASESTR''@/$(GL_GNULIB_STRCASESTR)/g' \
-e 's/@''GNULIB_STRTOK_R''@/$(GL_GNULIB_STRTOK_R)/g' \ -e 's/@''GNULIB_STRTOK_R''@/$(GL_GNULIB_STRTOK_R)/g' \
-e 's/@''GNULIB_STR_ENDSWITH''@/$(GL_GNULIB_STR_ENDSWITH)/g' \
-e 's/@''GNULIB_STR_STARTSWITH''@/$(GL_GNULIB_STR_STARTSWITH)/g' \
-e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \ -e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \
-e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \ -e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \
-e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \ -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \

View file

@ -19,6 +19,9 @@
#ifndef _LIBC #ifndef _LIBC
# include <time.h> # include <time.h>
# define __libc_lock_lock(lock) ((void) 0)
# define __libc_lock_unlock(lock) ((void) 0)
# define __tzset_unlocked() tzset ()
#endif #endif
/* mktime_offset_t is a signed type wide enough to hold a UTC offset /* mktime_offset_t is a signed type wide enough to hold a UTC offset
@ -73,6 +76,8 @@ typedef int mktime_offset_t;
/* Subroutine of mktime. Return the time_t representation of TP and /* Subroutine of mktime. Return the time_t representation of TP and
normalize TP, given that a struct tm * maps to a time_t. If normalize TP, given that a struct tm * maps to a time_t. If
LOCAL, the mapping is performed by localtime_r, otherwise by gmtime_r. LOCAL, the mapping is performed by localtime_r, otherwise by gmtime_r.
Record next guess for localtime-gmtime offset in *OFFSET. */ Record next guess for localtime-gmtime offset in *OFFSET.
If _LIBC, the caller must lock __tzset_lock. */
extern __time64_t __mktime_internal (struct tm *tp, bool local, extern __time64_t __mktime_internal (struct tm *tp, bool local,
mktime_offset_t *offset) attribute_hidden; mktime_offset_t *offset) attribute_hidden;

View file

@ -62,6 +62,9 @@
# define NEED_MKTIME_WORKING 0 # define NEED_MKTIME_WORKING 0
#endif #endif
#ifdef _LIBC
# include <tzset.h>
#endif
#include "mktime-internal.h" #include "mktime-internal.h"
#if !defined _LIBC && (NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS) #if !defined _LIBC && (NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS)
@ -98,8 +101,8 @@ my_tzset (void)
tzset (); tzset ();
# endif # endif
} }
# undef __tzset # undef tzset
# define __tzset() my_tzset () # define tzset() my_tzset ()
#endif #endif
#if defined _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_INTERNAL #if defined _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_INTERNAL
@ -250,6 +253,7 @@ tm_diff (long_int year, long_int yday, int hour, int min, int sec,
tp->tm_hour, tp->tm_min, tp->tm_sec); tp->tm_hour, tp->tm_min, tp->tm_sec);
} }
#ifndef _LIBC
/* Convert T to a struct tm value in *TM. Use localtime64_r if LOCAL, /* Convert T to a struct tm value in *TM. Use localtime64_r if LOCAL,
otherwise gmtime64_r. T must be in range for __time64_t. Return otherwise gmtime64_r. T must be in range for __time64_t. Return
TM if successful, NULL (setting errno) on failure. */ TM if successful, NULL (setting errno) on failure. */
@ -262,8 +266,8 @@ convert_time (long_int t, bool local, struct tm *tm)
else else
return __gmtime64_r (&x, tm); return __gmtime64_r (&x, tm);
} }
/* Call it __tzconvert to sync with other parts of glibc. */ # define __tz_convert convert_time
#define __tz_convert convert_time #endif
/* Convert *T to a broken down time in *TP (as if by localtime if /* Convert *T to a broken down time in *TP (as if by localtime if
LOCAL, otherwise as if by gmtime). If *T is out of range for LOCAL, otherwise as if by gmtime). If *T is out of range for
@ -320,7 +324,9 @@ ranged_convert (bool local, long_int *t, struct tm *tp)
If *OFFSET's guess is correct, only one reverse mapping call is If *OFFSET's guess is correct, only one reverse mapping call is
needed. If successful, set *TP to the canonicalized struct tm; needed. If successful, set *TP to the canonicalized struct tm;
otherwise leave *TP alone, return ((time_t) -1) and set errno. otherwise leave *TP alone, return ((time_t) -1) and set errno.
This function is external because it is used also by timegm.c. */ This function is external because it is used also by timegm.c.
If _LIBC, the caller must lock __tzset_lock. */
__time64_t __time64_t
__mktime_internal (struct tm *tp, bool local, mktime_offset_t *offset) __mktime_internal (struct tm *tp, bool local, mktime_offset_t *offset)
{ {
@ -349,12 +355,10 @@ __mktime_internal (struct tm *tp, bool local, mktime_offset_t *offset)
int mday = tp->tm_mday; int mday = tp->tm_mday;
int mon = tp->tm_mon; int mon = tp->tm_mon;
int year_requested = tp->tm_year; int year_requested = tp->tm_year;
int isdst = tp->tm_isdst;
/* Ignore any tm_isdst request for timegm. */ /* True if the previous probe was DST. */
int isdst = local ? tp->tm_isdst : 0; bool dst2 = false;
/* 1 if the previous probe was DST. */
int dst2 = 0;
/* Ensure that mon is in range, and set year accordingly. */ /* Ensure that mon is in range, and set year accordingly. */
int mon_remainder = mon % 12; int mon_remainder = mon % 12;
@ -443,13 +447,10 @@ __mktime_internal (struct tm *tp, bool local, mktime_offset_t *offset)
Heuristic: probe the adjacent timestamps in both directions, Heuristic: probe the adjacent timestamps in both directions,
looking for the desired isdst. If none is found within a looking for the desired isdst. If none is found within a
reasonable duration bound, assume a one-hour DST difference. reasonable duration bound, ignore the disagreement.
This should work for all real time zone histories in the tz This should work for all real time zone histories in the tz
database. */ database. */
/* +1 if we wanted standard time but got DST, -1 if the reverse. */
int dst_difference = (isdst == 0) - (tm.tm_isdst == 0);
/* Distance between probes when looking for a DST boundary. In /* Distance between probes when looking for a DST boundary. In
tzdata2003a, the shortest period of DST is 601200 seconds tzdata2003a, the shortest period of DST is 601200 seconds
(e.g., America/Recife starting 2000-10-08 01:00), and the (e.g., America/Recife starting 2000-10-08 01:00), and the
@ -459,21 +460,17 @@ __mktime_internal (struct tm *tp, bool local, mktime_offset_t *offset)
periods when probing. */ periods when probing. */
int stride = 601200; int stride = 601200;
/* In TZDB 2021e, the longest period of DST (or of non-DST), in /* Do not probe too far away from the requested time,
which the DST (or adjacent DST) difference is not one hour, by striding until at least a year has passed, but then giving up.
is 457243209 seconds: e.g., America/Cambridge_Bay with leap This helps avoid unexpected results in (for example) Asia/Kolkata,
seconds, starting 1965-10-31 00:00 in a switch from for which today's users expect to see no DST even though it
double-daylight time (-05) to standard time (-07), and did observe DST long ago. */
continuing to 1980-04-27 02:00 in a switch from standard time int year_seconds_bound = 366 * 24 * 60 * 60 + 1;
(-07) to daylight time (-06). */ int delta_bound = year_seconds_bound + stride;
int duration_max = 457243209;
/* Search in both directions, so the maximum distance is half
the duration; add the stride to avoid off-by-1 problems. */
int delta_bound = duration_max / 2 + stride;
int delta, direction; int delta, direction;
/* Search in both directions, closest first. */
for (delta = stride; delta < delta_bound; delta += stride) for (delta = stride; delta < delta_bound; delta += stride)
for (direction = -1; direction <= 1; direction += 2) for (direction = -1; direction <= 1; direction += 2)
{ {
@ -503,13 +500,8 @@ __mktime_internal (struct tm *tp, bool local, mktime_offset_t *offset)
} }
} }
/* No unusual DST offset was found nearby. Assume one-hour DST. */ /* No probe with the requested tm_isdst was found nearby.
t += 60 * 60 * dst_difference; Ignore the requested tm_isdst. */
if (mktime_min <= t && t <= mktime_max && __tz_convert (t, local, &tm))
goto offset_found;
__set_errno (EOVERFLOW);
return -1;
} }
offset_found: offset_found:
@ -548,17 +540,19 @@ __mktime_internal (struct tm *tp, bool local, mktime_offset_t *offset)
__time64_t __time64_t
__mktime64 (struct tm *tp) __mktime64 (struct tm *tp)
{ {
/* POSIX.1 requires mktime to set external variables like 'tzname' __libc_lock_lock (__tzset_lock);
as though tzset had been called. */ __tzset_unlocked ();
__tzset ();
# if defined _LIBC || NEED_MKTIME_WORKING # if defined _LIBC || NEED_MKTIME_WORKING
static mktime_offset_t localtime_offset; static mktime_offset_t localtime_offset;
return __mktime_internal (tp, true, &localtime_offset); __time64_t result = __mktime_internal (tp, true, &localtime_offset);
# else # else
# undef mktime # undef mktime
return mktime (tp); __time64_t result = mktime (tp);
# endif # endif
__libc_lock_unlock (__tzset_lock);
return result;
} }
#endif /* _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS */ #endif /* _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS */

View file

@ -62,8 +62,9 @@
/* NetBSD 5.0 mis-defines NULL. */ /* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h> #include <stddef.h>
/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */ /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.
#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS glibc 2.40 defines WCOREDUMP in <sys/wait.h>, not in <stdlib.h>. */
#if @GNULIB_SYSTEM_POSIX@ && !(defined WEXITSTATUS && defined WCOREDUMP)
# include <sys/wait.h> # include <sys/wait.h>
#endif #endif

View file

@ -1077,6 +1077,22 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
/* The following functions are not specified by POSIX. They are gnulib /* The following functions are not specified by POSIX. They are gnulib
extensions. */ extensions. */
#if @GNULIB_STR_STARTSWITH@
/* Returns true if STRING starts with PREFIX.
Returns false otherwise. */
_GL_EXTERN_C bool str_startswith (const char *string, const char *prefix)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
#if @GNULIB_STR_ENDSWITH@
/* Returns true if STRING ends with SUFFIX.
Returns false otherwise. */
_GL_EXTERN_C bool str_endswith (const char *string, const char *prefix)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
#if @GNULIB_MBSLEN@ #if @GNULIB_MBSLEN@
/* Return the number of multibyte characters in the character string STRING. /* Return the number of multibyte characters in the character string STRING.
This considers multibyte characters, unlike strlen, which counts bytes. */ This considers multibyte characters, unlike strlen, which counts bytes. */
@ -1301,6 +1317,26 @@ _GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim,
_GL_ARG_NONNULL ((2, 3)); _GL_ARG_NONNULL ((2, 3));
#endif #endif
#if @GNULIB_MBS_STARTSWITH@
/* Returns true if STRING starts with PREFIX.
Returns false otherwise. */
_GL_EXTERN_C bool mbs_startswith (const char *string, const char *prefix)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
/* No extra code is needed for multibyte locales for this function. */
# define mbs_startswith str_startswith
#endif
#if @GNULIB_MBS_ENDSWITH@
/* Returns true if STRING ends with SUFFIX.
Returns false otherwise.
Unlike str_endswith(), this function works correctly in multibyte locales.
*/
_GL_EXTERN_C bool mbs_endswith (const char *string, const char *suffix)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
/* Map any int, typically from errno, into an error message. */ /* Map any int, typically from errno, into an error message. */
#if @GNULIB_STRERROR@ #if @GNULIB_STRERROR@
# if @REPLACE_STRERROR@ # if @REPLACE_STRERROR@

View file

@ -165,12 +165,18 @@
#if @HAVE_WINSOCK2_H@ #if @HAVE_WINSOCK2_H@
/* Define type 'suseconds_t'. */
# if !GNULIB_defined_suseconds_t
typedef int suseconds_t;
# define GNULIB_defined_suseconds_t 1
# endif
# if !GNULIB_defined_rpl_fd_isset # if !GNULIB_defined_rpl_fd_isset
/* Re-define FD_ISSET to avoid a WSA call while we are not using /* Re-define FD_ISSET to avoid a WSA call while we are not using
network sockets. */ network sockets. */
static int static int
rpl_fd_isset (SOCKET fd, fd_set * set) rpl_fd_isset (SOCKET fd, const fd_set * set)
{ {
u_int i; u_int i;
if (set == NULL) if (set == NULL)

View file

@ -1,5 +1,5 @@
# assert_h.m4 # assert_h.m4
# serial 4 # serial 5
dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl Copyright (C) 2011-2025 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,
@ -64,11 +64,13 @@ AC_DEFUN([gl_ASSERT_H],
[#if (!(defined __clang__ \ [#if (!(defined __clang__ \
? (defined __cplusplus \ ? (defined __cplusplus \
? __cplusplus >= 201703L \ ? __cplusplus >= 201703L \
: __STDC_VERSION__ >= 202000L && __clang_major__ >= 16) \ : __STDC_VERSION__ >= 202000L && __clang_major__ >= 16 \
&& !defined __sun) \
: (defined __GNUC__ \ : (defined __GNUC__ \
? (defined __cplusplus \ ? (defined __cplusplus \
? __cplusplus >= 201103L && __GNUG__ >= 6 \ ? __cplusplus >= 201103L && __GNUG__ >= 6 \
: __STDC_VERSION__ >= 202000L && __GNUC__ >= 13) \ : __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \
&& !defined __sun) \
: defined HAVE_C_STATIC_ASSERT)) \ : defined HAVE_C_STATIC_ASSERT)) \
&& !defined assert \ && !defined assert \
&& (!defined __cplusplus \ && (!defined __cplusplus \

View file

@ -1,5 +1,5 @@
# string_h.m4 # string_h.m4
# serial 39 # serial 43
dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl Copyright (C) 2007-2025 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,
@ -70,6 +70,8 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STR_STARTSWITH])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STR_ENDSWITH])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR])
@ -84,6 +86,8 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_STARTSWITH])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_ENDSWITH])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP])

View file

@ -1,5 +1,5 @@
# sys_socket_h.m4 # sys_socket_h.m4
# serial 29 # serial 31
dnl Copyright (C) 2005-2025 Free Software Foundation, Inc. dnl Copyright (C) 2005-2025 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,
@ -53,24 +53,10 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H],
fi fi
# We need to check for ws2tcpip.h now. # We need to check for ws2tcpip.h now.
gl_PREREQ_SYS_H_SOCKET gl_PREREQ_SYS_H_SOCKET
AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ gl_PREREQ_SYS_SA_FAMILY
/* sys/types.h is not needed according to POSIX, but the
sys/socket.h in i386-unknown-freebsd4.10 and
powerpc-apple-darwin5.5 required it. */
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
])
if test $ac_cv_type_struct_sockaddr_storage = no; then if test $ac_cv_type_struct_sockaddr_storage = no; then
HAVE_STRUCT_SOCKADDR_STORAGE=0 HAVE_STRUCT_SOCKADDR_STORAGE=0
fi fi
if test $ac_cv_type_sa_family_t = no; then
HAVE_SA_FAMILY_T=0
fi
if test $ac_cv_type_struct_sockaddr_storage != no; then if test $ac_cv_type_struct_sockaddr_storage != no; then
AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],
[], [],
@ -159,6 +145,32 @@ AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP],
AC_SUBST([HAVE_WS2TCPIP_H]) AC_SUBST([HAVE_WS2TCPIP_H])
]) ])
# Common prerequisites of the <sys/socket.h> replacement and of the <sys/un.h>
# replacement.
# Sets and substitutes HAVE_SA_FAMILY_T.
AC_DEFUN([gl_PREREQ_SYS_SA_FAMILY],
[
AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])
AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[
/* sys/types.h is not needed according to POSIX, but the
sys/socket.h in i386-unknown-freebsd4.10 and
powerpc-apple-darwin5.5 required it. */
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
])
if test $ac_cv_type_sa_family_t = yes; then
HAVE_SA_FAMILY_T=1
else
HAVE_SA_FAMILY_T=0
fi
AC_SUBST([HAVE_SA_FAMILY_T])
])
# gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) # gl_SYS_SOCKET_MODULE_INDICATOR([modulename])
# sets the shell variable that indicates the presence of the given module # sets the shell variable that indicates the presence of the given module
# to a C preprocessor expression that will evaluate to 1. # to a C preprocessor expression that will evaluate to 1.
@ -203,6 +215,5 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1;
AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY])
HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T])
HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4])
]) ])