rootdev: remove deprecated readdir_r
glibc 2.27 has removed deprecated readdir_r, and we need to
use readdir to replace it.
BUG=chromium:859593
TEST=FEATURES="test" USE="asan" emerge-samus rootdev
Change-Id: I52da7a24a077fe06a68c7092039e6c3b9ca361ae
Reviewed-on: https://chromium-review.googlesource.com/1123022
Commit-Ready: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Caroline Tice <cmtice@chromium.org>
diff --git a/rootdev.c b/rootdev.c
index 3cad4f4..ce1a970 100644
--- a/rootdev.c
+++ b/rootdev.c
@@ -96,7 +96,6 @@
size_t basedir_len;
DIR *dirp = NULL;
struct dirent *entry = NULL;
- struct dirent *next = NULL;
char *working_path = NULL;
long working_path_size = 0;
@@ -142,7 +141,7 @@
return found;
}
- while (readdir_r(dirp, entry, &next) == 0 && next) {
+ while ((entry = readdir(dirp))) {
size_t candidate_len = strlen(entry->d_name);
size_t path_len = 0;
dev_t found_devt = 0;
@@ -191,7 +190,6 @@
}
free(working_path);
- free(entry);
closedir(dirp);
return found;
}