readdir_r() is deprecated in modern glibc versions. readdir() is thread safe in practice, as long as there are no concurrent accesses on the *same* directory stream.