X-Git-Url: https://www.kengrimes.com/gitweb/?p=henge%2Fapc.git;a=blobdiff_plain;f=src%2Fscanner.c;h=14266ca47ad30cd4cf796c0c2acb6212f93c61cb;hp=5c06a4e2b7cdcac951c1ce9ea3b2cb00fece15ab;hb=0dc97f87cbbe47ef84501678f302404d042428b1;hpb=59c61dc6411254681b81571dd580336a75c0100d diff --git a/src/scanner.c b/src/scanner.c index 5c06a4e..14266ca 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -223,7 +223,11 @@ int dredge_current_depth struct dirent* direntp; DL_CD_INIT(); scan_next: - if ((direntp = readdir(cwd)) != NULL) + errno = 0; + direntp = readdir(cwd); + if (errno) + return -1; + if (direntp != NULL) { switch (direntp->d_type) { case DT_REG: DPS_PUSH(direntp); @@ -239,8 +243,6 @@ int dredge_current_depth goto scan_next; } } - if (errno) - return -1; qsort(lexer_direntpa, DPS_LEN(), sizeof direntp, (qcomp)alphasort); return DPS_LEN(); }