Since glibc 2.24 readdir_r() is deprecated.
Applications are recommended to use readdir which is thread-safe when
using different directory streams (we explicitly create a new one here).
* src/abg-tools-utils.cc (dir_is_empty): Use readdir() instead
of readdir_r().
Signed-off-by: Mark Wielaard <mark@klomp.org>
#include <cstdlib>
#include <cstring>
#include <ctype.h>
+#include <errno.h>
#include <libgen.h>
#include <ext/stdio_filebuf.h> // For __gnu_cxx::stdio_filebuf
#include <fstream>
if (!dir)
return false;
- dirent entry, *result = 0;
- if (readdir_r(dir, &entry, &result))
+ errno = 0;
+ dirent *result = readdir(dir);
+ if (result == NULL && errno != 0)
return false;
closedir(dir);
- return result == 0;
+ return result == NULL;
}
/// Test if path is a path to a regular file or a symbolic link to a