summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2012-08-02 01:56:02 +0200
committerCarlos Martín Nieto <carlos@cmartin.tk>2012-08-02 02:12:16 +0200
commitd96c3863a50f2a9b0f33735911e5472fec3ad288 (patch)
treea7e029394db59e57da139f8fa68878fa74fb3913 /src
parente25dda51c4dc47ed99f95dae6486c6275b119484 (diff)
downloadlibgit2-d96c3863a50f2a9b0f33735911e5472fec3ad288.tar.gz
win32: set errno to ENOENT or ENOTDIR when appropriate in do_lstat
Diffstat (limited to 'src')
-rw-r--r--src/win32/posix_w32.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index 4e0150fb5..e1471cab4 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -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;
}