Replace deprecated readdir_r() with readdir()
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Tue, 30 Dec 2025 08:54:15 +0000 (09:54 +0100)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Wed, 31 Dec 2025 11:11:25 +0000 (12:11 +0100)
commit402cb5a1379a3392f73effe9e0155f5dd152ab52
tree1b6f4ad2bb7476270025e64da840929399b6d97c
parent8d8bb7cef43204ab8a8a24adf2203bbc071435ae
Replace deprecated readdir_r() with readdir()

Original warnings:
src/filefunc.cpp:318:21: error: 'int readdir_r(DIR*, dirent*, dirent**)' is deprecated [-Werror=deprecated-declarations]
src/filefunc.cpp:360:21: error: 'int readdir_r(DIR*, dirent*, dirent**)' is deprecated [-Werror=deprecated-declarations]
src/filefunc.cpp:362:27: error: the address of 'dirent::d_name' will never be NULL [-Werror=address]

The readdir_r() function is deprecated in favor of readdir(), which is
thread-safe on Linux with glibc since many years. I checked the glibc 2.17 source code
and it uses a lock internally (and also traced it back to at least 2012).

Also removed the unnecessary NULL check for d_name since it is never NULL per POSIX.
src/filefunc.cpp