mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-03 21:30:14 -05:00
Handle trailing-slash paths in Windows lstat using handle-based states starting
This commit is contained in:
parent
4f286a2faa
commit
0416366e2d
1 changed files with 9 additions and 0 deletions
|
|
@ -748,6 +748,15 @@ int windows_lstat(const char* file, struct windows_stat* st)
|
||||||
wchar_t conv_buf[CONV_MAX];
|
wchar_t conv_buf[CONV_MAX];
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
WIN32_FIND_DATAW data;
|
WIN32_FIND_DATAW data;
|
||||||
|
size_t len = strlen(file);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A trailing slash requires resolving the final component as a directory.
|
||||||
|
* Use the handle-based implementation because FindFirstFileW() rejects the
|
||||||
|
* trailing slash, while preserving its faster path for all normal entries.
|
||||||
|
*/
|
||||||
|
if (len != 0 && is_slash(file[len - 1]))
|
||||||
|
return windows_stat(file, st);
|
||||||
|
|
||||||
/* FindFirstFileW by default gets information of symbolic links and not of their targets */
|
/* FindFirstFileW by default gets information of symbolic links and not of their targets */
|
||||||
h = FindFirstFileW(convert(conv_buf, file), &data);
|
h = FindFirstFileW(convert(conv_buf, file), &data);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue