summaryrefslogtreecommitdiff
path: root/libc/misc/dirent/readdir_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/dirent/readdir_r.c')
-rw-r--r--libc/misc/dirent/readdir_r.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libc/misc/dirent/readdir_r.c b/libc/misc/dirent/readdir_r.c
index 2c44707f2..a1d8b9a77 100644
--- a/libc/misc/dirent/readdir_r.c
+++ b/libc/misc/dirent/readdir_r.c
@@ -34,7 +34,7 @@ int readdir_r(DIR *dir, struct dirent *entry, struct dirent **result)
bytes = __getdents(dir->dd_fd, dir->dd_buf, dir->dd_max);
if (bytes <= 0) {
*result = NULL;
- ret = errno;
+ ret = (bytes==0)? 0 : errno;
goto all_done;
}
dir->dd_size = bytes;