On 2026-06-16 11:36, Bruno Haible wrote:
If HAVE_FACCESSAT is 1 and LSTAT_FOLLOWS_SLASHED_SYMLINK is not 1,
Gnulib does not define rpl_faccessat.
Thanks, I installed the attached, cheating a bit by editing the recent
ChangeLog entry rather than writing a new one.From e4f006251579379a510e5c09d3def6a435807cca Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Tue, 16 Jun 2026 12:08:19 -0700
Subject: [PATCH] faccessat: simplify latest change
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Suggested by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2026-06/msg00065.html
* lib/faccessat.c (LSTAT_FOLLOWS_SLASHED_SYMLINK): Remove.
(rpl_faccessat): Assume it’s false.
---
ChangeLog | 7 +++----
lib/faccessat.c | 6 +-----
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5bf7f08c52..a3096cefeb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -37,10 +37,9 @@
New macro. Needed for Solaris 10.
faccessat: support "" and NULL file
- * lib/faccessat.c (LSTAT_FOLLOWS_SLASHED_SYMLINK): Default to 0.
- (rpl_faccessat): Don’t mishandle empty string, or null pointer for
- that matter. Also, do not call fstatat if
- LSTAT_FOLLOWS_SLASHED_SYMLINK, as there is no need in that case.
+ * lib/faccessat.c (rpl_faccessat): Don’t mishandle empty string,
+ or null pointer for that matter. (Thanks to Bruno Haible for
+ reviewing and suggesting a simplification.)
fcntl-h: glibc now has openat2
* m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): HAVE_OPENAT2 is now 1,
diff --git a/lib/faccessat.c b/lib/faccessat.c
index ad5720236b..c1463aa70e 100644
--- a/lib/faccessat.c
+++ b/lib/faccessat.c
@@ -50,10 +50,6 @@ orig_faccessat (int fd, char const *name, int mode, int flag)
# define access euidaccess
#endif
-#ifndef LSTAT_FOLLOWS_SLASHED_SYMLINK
-# define LSTAT_FOLLOWS_SLASHED_SYMLINK 0
-#endif
-
#if HAVE_FACCESSAT
int
@@ -61,7 +57,7 @@ rpl_faccessat (int fd, char const *file, int mode, int flags)
{
int result = orig_faccessat (fd, file, mode, flags);
- if (!LSTAT_FOLLOWS_SLASHED_SYMLINK && file)
+ if (file)
{
size_t len = strlen (file);
if (len && file[len - 1] == '/')
--
2.53.0