From: Alan Cox Date: Thu, 4 Jun 2015 17:11:29 +0000 (+0100) Subject: readdir: don't loop on error X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=c91f19ab989cbafb0a0fe47613c34fd33acf7cc4;p=FUZIX.git readdir: don't loop on error --- diff --git a/Library/libs/readdir.c b/Library/libs/readdir.c index a25c2737..924e6633 100644 --- a/Library/libs/readdir.c +++ b/Library/libs/readdir.c @@ -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;