[PATCH 0/3] tools/nolibc: verify that a directory is opened

Thomas Weißschuh posted 3 patches 3 weeks, 4 days ago
tools/include/nolibc/dirent.h                | 18 ++++++++++++++++--
tools/testing/selftests/nolibc/nolibc-test.c |  2 ++
2 files changed, 18 insertions(+), 2 deletions(-)
[PATCH 0/3] tools/nolibc: verify that a directory is opened
Posted by Thomas Weißschuh 3 weeks, 4 days ago
If a non-directory is opened, ENODIR should be returned from
opendir()/fdopendir() right away and not only during readdir_r().

Validate the type of opened file during open.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (3):
      tools/nolibc: verify that a directory is opened
      selftests/nolibc: validate ENOTDIR return values from opendir()/fdopendir()
      tools/nolibc: validate directory with O_DIRECTORY in opendir()

 tools/include/nolibc/dirent.h                | 18 ++++++++++++++++--
 tools/testing/selftests/nolibc/nolibc-test.c |  2 ++
 2 files changed, 18 insertions(+), 2 deletions(-)
---
base-commit: 9c47af906bc655c8f45aaf1f156656239c2c5073
change-id: 20260831-nolibc-fdopendir-enotdir-3d7b39eedb51

Best regards,
--  
Thomas Weißschuh <linux@weissschuh.net>

Re: [PATCH 0/3] tools/nolibc: verify that a directory is opened
Posted by Willy Tarreau 3 weeks, 4 days ago
Hi Thomas,

On Mon, Aug 31, 2026 at 06:04:58PM +0200, Thomas Weißschuh wrote:
> If a non-directory is opened, ENODIR should be returned from
> opendir()/fdopendir() right away and not only during readdir_r().
> 
> Validate the type of opened file during open.

Great points, I agree this is much cleaner this way!

> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

For the whole series:

Reviewed-by: Willy Tarreau <w@1wt.eu>

Thanks!
Willy