Commit fbfd4d02 authored by Chris Lamb's avatar Chris Lamb

Rewrite call to readdir_r(3) to use readdir(3) instead as the former has been…

Rewrite call to readdir_r(3) to use readdir(3) instead as the former has been deprecated in glibc 2.24. This silences a -Wdeprecated-declarations GCC warning.
parent 4810a119
......@@ -425,12 +425,14 @@ int main (int argc, char** argv)
if (!d) {
return -errno;
}
struct dirent dirent_storage;
struct dirent* dirent_p;
int res;
while ((res = readdir_r(d, &dirent_storage, &dirent_p)) == 0 && dirent_p) {
errno = 0;
while ((dirent_p = readdir(d)) != NULL) {
dirents->emplace_back(std::make_pair(dirent_p->d_name, dirent_p->d_ino));
}
if (errno != 0) {
return -errno;
}
if (config.sort_dirents) {
std::sort(dirents->begin(), dirents->end());
}
......@@ -438,8 +440,8 @@ int main (int argc, char** argv)
std::reverse(dirents->begin(), dirents->end());
}
closedir(d);
if (res != 0) {
return -res;
if (errno != 0) {
return -errno;
}
set_fuse_data<Dirents*>(info, dirents.release());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment