mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-12 12:20:06 +00:00
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.
This commit is contained in:
parent
81aaf3704a
commit
e164ddb11d
@ -148,12 +148,19 @@ static int lstat_w(
|
|||||||
return git_win32__file_attribute_to_stat(buf, &fdata, path);
|
return git_win32__file_attribute_to_stat(buf, &fdata, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (GetLastError()) {
|
||||||
|
case ERROR_ACCESS_DENIED:
|
||||||
|
errno = EACCES;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* To match POSIX behavior, set ENOTDIR when any of the folders in the
|
/* To match POSIX behavior, set ENOTDIR when any of the folders in the
|
||||||
* file path is a regular file, otherwise set ENOENT.
|
* file path is a regular file, otherwise set ENOENT.
|
||||||
*/
|
*/
|
||||||
if (posix_enotdir) {
|
if (errno == ENOENT && posix_enotdir) {
|
||||||
size_t path_len = wcslen(path);
|
size_t path_len = wcslen(path);
|
||||||
|
|
||||||
/* scan up path until we find an existing item */
|
/* scan up path until we find an existing item */
|
||||||
|
Loading…
Reference in New Issue
Block a user