Browse Source

fix bug 1012 as noted by moschny

Eric Andersen 18 years ago
parent
commit
285768c7f0
1 changed files with 1 additions and 1 deletions
  1. 1 1
      libc/misc/dirent/readdir_r.c

+ 1 - 1
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;