wip
[henge/apc.git] / src / scanner.c
index 5c06a4e..14266ca 100644 (file)
@@ -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();
 }