readdir: don't loop on error
authorAlan Cox <alan@linux.intel.com>
Thu, 4 Jun 2015 17:11:29 +0000 (18:11 +0100)
committerAlan Cox <alan@linux.intel.com>
Thu, 4 Jun 2015 17:11:29 +0000 (18:11 +0100)
Library/libs/readdir.c

index a25c273..924e663 100644 (file)
@@ -13,7 +13,7 @@ static struct __dirent *dnext(struct _dir *dir)
 {
         if (dir->next == dir->last) {
                 int l = read(dir->d.dd_fd, dir->buf, sizeof(dir->buf));
-                if (l == 0)
+                if (l <= 0)
                         return NULL;
                 l /= 32;
                 dir->last = l;