[PATCH v2] io: Fix silent readdir failures in ftw/nftw (BZ 33085)
Andreas Schwab
schwab@suse.de
Mon Nov 9 15:24:08 GMT 2026
On Apr 20 2026, Adhemerval Zanella wrote:
> The {n}ftw functions fails to distinguish between the end of a directory
> stream and an read error. The existing implementation treated all
> NULL returns as the end of the stream, silently swallowing file system
> or I/O errors and incorrectly reporting a successful traversal.
>
> This patch fixes the issue in two places within io/ftw.c:
>
> 1. In open_dir_stream (the fallback loop used when the file
> descriptor limit is exhausted and directory entries must be cached).
>
> 2. In ftw_dir (the main directory reading loop, specifically within
> FTW_STATE_STREAM_LOOP).
>
> The testcasuse uses the FUSE libsupport to trigger getdents failure
> in this two readdir calls.
Ok.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
More information about the Libc-alpha
mailing list