X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Futils-dir.c;h=53e2cc5c0a337f43deb82ad34bf0f6b29acea487;hb=a123bb31906ef03ff813559aee426282416d729d;hp=96e803bd6150b95c9ad11c58ff40ce2e3c463903;hpb=2c6fcae14552ab6e7addc82516617a135f86b5ca;p=src%2Fapp-framework-main.git diff --git a/src/utils-dir.c b/src/utils-dir.c index 96e803b..53e2cc5 100644 --- a/src/utils-dir.c +++ b/src/utils-dir.c @@ -1,5 +1,5 @@ /* - Copyright 2015 IoT.bzh + Copyright (C) 2015-2020 IoT.bzh author: José Bollo @@ -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;