diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-09-17 12:23:19 -0400 |
---|---|---|
committer | Carlos MartÃn Nieto <cmn@dwim.me> | 2015-11-04 17:01:02 -0800 |
commit | ad8e8fa768c44e3a4e0c12c831fd76ef863a5419 (patch) | |
tree | 5a22b84a3669d9f8c5e5c59bdfe8aa5ba3c8e078 | |
parent | 59ac22422b02bed4c1c782ec5bdc58c937135a9a (diff) | |
download | libgit2-ad8e8fa768c44e3a4e0c12c831fd76ef863a5419.tar.gz |
win32: return EACCES in `p_lstat`
Don't coalesce all errors into ENOENT. At least identify EACCES.
All callers should be handling this case already, as the POSIX
`lstat` will return this.
-rw-r--r-- | src/win32/posix_w32.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c index 504562b0e..e7aa6fc7c 100644 --- a/src/win32/posix_w32.c +++ b/src/win32/posix_w32.c @@ -146,12 +146,19 @@ static int lstat_w( return git_win32__file_attribute_to_stat(buf, &fdata, path); } - errno = ENOENT; + switch (GetLastError()) { + case ERROR_ACCESS_DENIED: + errno = EACCES; + break; + default: + errno = ENOENT; + break; + } /* To match POSIX behavior, set ENOTDIR when any of the folders in the * file path is a regular file, otherwise set ENOENT. */ - if (posix_enotdir) { + if (errno == ENOENT && posix_enotdir) { size_t path_len = wcslen(path); /* scan up path until we find an existing item */ |