On 2026-04-17 06:24, Adhemerval Zanella wrote:

+     When fts_info == FTS_NSOK this supports expressions like
+     (fts_statp->st_mode ? !!S_ISDIR (fts_statp->st_mode): -1), which yields
+     1 for a directory, 0 for a non-directory, and -1 for unknown.  */

In rereading this patch, I suggest changing the example to use a FIFO rather than a directory, since directories never yield fts_info == FTS_NSOK. I installed the attached patch into Gnulib and you can use this in glibc too. Sorry about the confusion.
From d8e2a2e266b9af73ccaf03c4bc9a039c342d4d98 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Fri, 17 Apr 2026 09:14:49 -0700
Subject: [PATCH] doc: doc FTS_NOSTAT with FIFO, not directory
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lib/fts.in.h (FTS_NOSTAT): Use a FIFO, not a directory,
in the commentary’s example.  This is a better example
because directories never have FTS_NSOK.
---
 lib/fts.in.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/fts.in.h b/lib/fts.in.h
index c45cd63b0b..6b2019c87b 100644
--- a/lib/fts.in.h
+++ b/lib/fts.in.h
@@ -133,8 +133,8 @@ typedef struct {
      which is set to zero if the file type is unknown,
      and which otherwise has at least its S_IFMT type bits set.
      When fts_info == FTS_NSOK this supports expressions like
-     (fts_statp->st_mode ? !!S_ISDIR (fts_statp->st_mode): -1), which yields
-     1 for a directory, 0 for a non-directory, and -1 for unknown.  */
+     (fts_statp->st_mode ? !!S_ISFIFO (fts_statp->st_mode): -1), which yields
+     1 for a FIFO, 0 for a non-FIFO, and -1 for unknown.  */
 # define FTS_NOSTAT     0x0008          /* don't get stat info */
 
 # define FTS_PHYSICAL   0x0010          /* physical walk */
-- 
2.51.0

Reply via email to