Explorar o código

fix bug 1012 as noted by moschny

Eric Andersen %!s(int64=19) %!d(string=hai) anos
pai
achega
285768c7f0
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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;