win32: dirent: handle errors

Previously all error conditions were ignored. Be nice, and set errno
when we should.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Erik Faye-Lund
2010-11-23 19:38:27 +01:00
committed by Junio C Hamano
parent 20c6788ace
commit 9585ed519c
2 changed files with 28 additions and 2 deletions

View File

@ -1582,7 +1582,7 @@ struct dirent *mingw_readdir(DIR *dir)
HANDLE handle;
struct mingw_DIR *mdir = (struct mingw_DIR*)dir;
if (!dir->dd_handle) {
if (!dir || !dir->dd_handle) {
errno = EBADF; /* No set_errno for mingw */
return NULL;
}