Commit d96c3863 by Carlos Martín Nieto

win32: set errno to ENOENT or ENOTDIR when appropriate in do_lstat

parent e25dda51
...@@ -60,6 +60,7 @@ GIT_INLINE(time_t) filetime_to_time_t(const FILETIME *ft) ...@@ -60,6 +60,7 @@ GIT_INLINE(time_t) filetime_to_time_t(const FILETIME *ft)
static int do_lstat(const char *file_name, struct stat *buf) static int do_lstat(const char *file_name, struct stat *buf)
{ {
WIN32_FILE_ATTRIBUTE_DATA fdata; WIN32_FILE_ATTRIBUTE_DATA fdata;
DWORD last_error;
wchar_t* fbuf = gitwin_to_utf16(file_name); wchar_t* fbuf = gitwin_to_utf16(file_name);
if (!fbuf) if (!fbuf)
return -1; return -1;
...@@ -93,6 +94,12 @@ static int do_lstat(const char *file_name, struct stat *buf) ...@@ -93,6 +94,12 @@ static int do_lstat(const char *file_name, struct stat *buf)
return 0; return 0;
} }
last_error = GetLastError();
if (last_error == ERROR_FILE_NOT_FOUND)
errno = ENOENT;
else if (last_error == ERROR_PATH_NOT_FOUND)
errno = ENOTDIR;
git__free(fbuf); git__free(fbuf);
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment