win,fs: avoid closing an invalid handle (#3473)
While usually functional, calling CloseHandle(INVALID_HANDLE_VALUE) can result in debug builds (and/or wine) being unhappy and aborting there.
This commit is contained in:
parent
0209466496
commit
3b2c25d223
15
src/win/fs.c
15
src/win/fs.c
@ -1880,8 +1880,9 @@ INLINE static DWORD fs__stat_impl_from_path(WCHAR* path,
|
||||
NULL);
|
||||
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
ret = GetLastError();
|
||||
else if (fs__stat_handle(handle, statbuf, do_lstat) != 0)
|
||||
return GetLastError();
|
||||
|
||||
if (fs__stat_handle(handle, statbuf, do_lstat) != 0)
|
||||
ret = GetLastError();
|
||||
else
|
||||
ret = 0;
|
||||
@ -2299,13 +2300,13 @@ INLINE static DWORD fs__utime_impl_from_path(WCHAR* path,
|
||||
flags,
|
||||
NULL);
|
||||
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
return GetLastError();
|
||||
|
||||
if (fs__utime_handle(handle, atime, mtime) != 0)
|
||||
ret = GetLastError();
|
||||
} else if (fs__utime_handle(handle, atime, mtime) != 0) {
|
||||
ret = GetLastError();
|
||||
} else {
|
||||
else
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
CloseHandle(handle);
|
||||
return ret;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user