From: Mark Wielaard Date: Sat, 2 Sep 2017 13:03:36 +0000 (+0200) Subject: readdir_r() is deprecated, use readdir(). X-Git-Tag: upstream/1.0~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b74fa3437cf929e836655c26de4c8183ee60896d;p=platform%2Fupstream%2Flibabigail.git readdir_r() is deprecated, use readdir(). 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 --- diff --git a/src/abg-tools-utils.cc b/src/abg-tools-utils.cc index d6a89b69..254c963c 100644 --- a/src/abg-tools-utils.cc +++ b/src/abg-tools-utils.cc @@ -29,6 +29,7 @@ #include #include #include +#include #include #include // For __gnu_cxx::stdio_filebuf #include @@ -209,13 +210,14 @@ dir_is_empty(const string &path) 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