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.