aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils-dir.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-01-05 17:09:55 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2017-01-05 17:11:36 +0100
commitc07d1ea01ae008dc5aa379932b1d2da90d7d291c (patch)
tree5d806e4cb7112597992bd9f1ee126fde3ff02f86 /src/utils-dir.c
parent3a6e947bef1b2942e24d2fdee1a76dbf3305b508 (diff)
Remove use of deprecated readdir_r
Change-Id: I55bd335f1a731e3a02fdb598c8bd869686269aab Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/utils-dir.c')
-rw-r--r--src/utils-dir.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/utils-dir.c b/src/utils-dir.c
index aef0a65..3c934fc 100644
--- a/src/utils-dir.c
+++ b/src/utils-dir.c
@@ -33,10 +33,6 @@ static int clean_dirfd(int dirfd)
int rc;
DIR *dir;
struct dirent *ent;
- struct {
- struct dirent entry;
- char spare[PATH_MAX];
- } entry;
dir = fdopendir(dirfd);
if (dir == NULL) {
@@ -45,10 +41,13 @@ static int clean_dirfd(int dirfd)
}
for (;;) {
rc = -1;
- if (readdir_r(dir, &entry.entry, &ent) != 0)
- goto error;
- if (ent == NULL)
+ errno = 0;
+ ent = readdir(dir);
+ if (ent == NULL) {
+ if (errno)
+ goto error;
break;
+ }
if (ent->d_name[0] == '.' && (ent->d_name[1] == 0
|| (ent->d_name[1] == '.' && ent->d_name[2] == 0)))
continue;