mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-08 22:08:56 +00:00
win32: set errno to ENOENT or ENOTDIR when appropriate in do_lstat
This commit is contained in:
parent
e25dda51c4
commit
d96c3863a5
@ -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)
|
||||
{
|
||||
WIN32_FILE_ATTRIBUTE_DATA fdata;
|
||||
DWORD last_error;
|
||||
wchar_t* fbuf = gitwin_to_utf16(file_name);
|
||||
if (!fbuf)
|
||||
return -1;
|
||||
@ -93,6 +94,12 @@ static int do_lstat(const char *file_name, struct stat *buf)
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user