2026-06-16 Paul Eggert <eggert@cs.ucla.edu>
+ fstatat etc.: fix wrong machine code for calls
+ Without this fix, compilers can generate incorrect machine code
+ for functions that call to fstatat-like functions, as the
+ compilers incorrectly assume that the calls’ arguments cannot be
+ null pointers. This assumption became false with the release of
+ Linux kernel 6.11 (2024).
+ * lib/sys_stat.in.h (fchmodat, fstatat, utimensat):
+ * lib/unistd.in.h (faccessat, fchownat): Do not mark file args
+ with _GL_ARG_NONNULL, as the args are allowed to be null pointers
+ in Linux kernel 6.11+, possibly with glibc 2.41+ involved.
+
euidaccess-tests: link with test_euidaccess_LDADD
* modules/euidaccess-tests (test_euidaccess_LDADD):
New macro. Needed for Solaris 10.
# define fchmodat rpl_fchmodat
# endif
_GL_FUNCDECL_RPL (fchmodat, int,
- (int fd, char const *file, mode_t mode, int flag),
- _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
+ (int fd, char const *file, mode_t mode, int flags),
+ _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (fchmodat, int,
- (int fd, char const *file, mode_t mode, int flag));
+ (int fd, char const *file, mode_t mode, int flags));
# else
# if !@HAVE_FCHMODAT@
_GL_FUNCDECL_SYS (fchmodat, int,
- (int fd, char const *file, mode_t mode, int flag),
- _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
+ (int fd, char const *file, mode_t mode, int flags),
+ _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (fchmodat, int,
- (int fd, char const *file, mode_t mode, int flag));
+ (int fd, char const *file, mode_t mode, int flags));
# endif
_GL_CXXALIASWARN (fchmodat);
#elif defined GNULIB_POSIXCHECK
_GL_FUNCDECL_RPL (fstatat, int,
(int fd, char const *restrict name, struct stat *restrict st,
int flags),
- _GL_ARG_NONNULL ((2, 3)));
+ _GL_ARG_NONNULL ((3)));
_GL_CXXALIAS_RPL (fstatat, int,
(int fd, char const *restrict name, struct stat *restrict st,
int flags));
_GL_FUNCDECL_SYS (fstatat, int,
(int fd, char const *restrict name, struct stat *restrict st,
int flags),
- _GL_ARG_NONNULL ((2, 3)));
+ _GL_ARG_NONNULL ((3)));
# endif
_GL_CXXALIAS_SYS (fstatat, int,
(int fd, char const *restrict name, struct stat *restrict st,
# define utimensat rpl_utimensat
# endif
_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
- struct timespec const times[2], int flag),
- _GL_ARG_NONNULL ((2)));
+ struct timespec const times[2], int flags),
+ );
_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
- struct timespec const times[2], int flag));
+ struct timespec const times[2], int flags));
# else
# if !@HAVE_UTIMENSAT@
_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
- struct timespec const times[2], int flag),
- _GL_ARG_NONNULL ((2)));
+ struct timespec const times[2], int flags),
+ );
# endif
_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
- struct timespec const times[2], int flag));
+ struct timespec const times[2], int flags));
# endif
# if __GLIBC__ >= 2 && @HAVE_UTIMENSAT@
_GL_CXXALIASWARN (utimensat);
# define faccessat rpl_faccessat
# endif
_GL_FUNCDECL_RPL (faccessat, int,
- (int fd, char const *name, int mode, int flag),
- _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
+ (int fd, char const *name, int mode, int flags),
+ _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (faccessat, int,
- (int fd, char const *name, int mode, int flag));
+ (int fd, char const *name, int mode, int flags));
# else
# if !@HAVE_FACCESSAT@
_GL_FUNCDECL_SYS (faccessat, int,
- (int fd, char const *file, int mode, int flag),
- _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
+ (int fd, char const *file, int mode, int flags),
+ _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (faccessat, int,
- (int fd, char const *file, int mode, int flag));
+ (int fd, char const *file, int mode, int flags));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (faccessat);
# define fchownat rpl_fchownat
# endif
_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
- uid_t owner, gid_t group, int flag),
- _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
+ uid_t owner, gid_t group, int flags),
+ _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
- uid_t owner, gid_t group, int flag));
+ uid_t owner, gid_t group, int flags));
# else
# if !@HAVE_FCHOWNAT@
_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
- uid_t owner, gid_t group, int flag),
- _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
+ uid_t owner, gid_t group, int flags),
+ _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
- uid_t owner, gid_t group, int flag));
+ uid_t owner, gid_t group, int flags));
# endif
_GL_CXXALIASWARN (fchownat);
#elif defined GNULIB_POSIXCHECK
# endif
_GL_FUNCDECL_RPL (linkat, int,
(int fd1, const char *path1, int fd2, const char *path2,
- int flag),
+ int flags),
_GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD);
_GL_CXXALIAS_RPL (linkat, int,
(int fd1, const char *path1, int fd2, const char *path2,
- int flag));
+ int flags));
# else
# if !@HAVE_LINKAT@
_GL_FUNCDECL_SYS (linkat, int,
(int fd1, const char *path1, int fd2, const char *path2,
- int flag),
+ int flags),
_GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD);
# endif
_GL_CXXALIAS_SYS (linkat, int,
(int fd1, const char *path1, int fd2, const char *path2,
- int flag));
+ int flags));
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (linkat);