diff options
Diffstat (limited to 'win/tclWinFile.c')
-rw-r--r-- | win/tclWinFile.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 18b05d6..8e517d1 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -1537,14 +1537,9 @@ NativeAccess( * File might not exist. */ - WIN32_FIND_DATA ffd; - HANDLE hFind; - hFind = FindFirstFile(nativePath, &ffd); - if (hFind != INVALID_HANDLE_VALUE) { - attr = ffd.dwFileAttributes; - FindClose(hFind); - } else { - TclWinConvertError(GetLastError()); + DWORD lasterror = GetLastError(); + if (lasterror != ERROR_SHARING_VIOLATION) { + TclWinConvertError(lasterror); return -1; } } @@ -2002,15 +1997,17 @@ NativeStat( if (GetFileAttributesEx(nativePath, GetFileExInfoStandard, &data) != TRUE) { - /* - * We might have just been denied access - */ - + HANDLE hFind; WIN32_FIND_DATA ffd; - HANDLE hFind = FindFirstFile(nativePath, &ffd); + DWORD lasterror = GetLastError(); + if (lasterror != ERROR_SHARING_VIOLATION) { + TclWinConvertError(lasterror); + return -1; + } + hFind = FindFirstFile(nativePath, &ffd); if (hFind == INVALID_HANDLE_VALUE) { - Tcl_SetErrno(ENOENT); + TclWinConvertError(GetLastError()); return -1; } memcpy(&data, &ffd, sizeof(data)); |