summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2008-11-02 09:36:14 -0800
committerDan Nicholson <dbn.lists@gmail.com>2008-11-02 09:36:14 -0800
commit48698bb6ce2e77dda8555bfbca8b10f8a640b930 (patch)
treeb0d6e4f62e5a8253af1f694ed59231d46441e9b8
parentc2d8ac0e5a2726df0c4da852d13238a591d85721 (diff)
Reset errno before readdir to avoid false errors
After readdir completes, errno is check to see if any errors were produced. However, if readdir is successful, it will not change the current errno value. Reset it before the loop to ensure any errors are due to the readdir calls.
-rw-r--r--lib/initd-list.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/initd-list.c b/lib/initd-list.c
index debb0a1..79dea34 100644
--- a/lib/initd-list.c
+++ b/lib/initd-list.c
@@ -102,6 +102,7 @@ initd_list_t *initd_list_from_dir(const char *dir)
if (!dfd)
error(2, errno, "%s", dir);
+ errno = 0;
while ((de = readdir(dfd))) {
char ip_path[PATH_MAX];
int plen;