summaryrefslogtreecommitdiffstats
path: root/win/tclWinFile.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tclWinFile.c')
-rw-r--r--win/tclWinFile.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 8ea6548..0ff219d 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -1337,11 +1337,14 @@ NativeAccess(
if (attr == 0xffffffff) {
/*
- * File doesn't exist.
+ * File might not exist.
*/
- TclWinConvertError(GetLastError());
- return -1;
+ DWORD lasterror = GetLastError();
+ if (lasterror != ERROR_SHARING_VIOLATION) {
+ TclWinConvertError(lasterror);
+ return -1;
+ }
}
if (mode == F_OK) {
@@ -1889,8 +1892,21 @@ NativeStat(nativePath, statPtr, checkLinks)
if((*tclWinProcs->getFileAttributesExProc)(nativePath,
GetFileExInfoStandard,
&data) != TRUE) {
- Tcl_SetErrno(ENOENT);
- return -1;
+ HANDLE hFind;
+ WIN32_FIND_DATAT ffd;
+ DWORD lasterror = GetLastError();
+
+ if (lasterror != ERROR_SHARING_VIOLATION) {
+ TclWinConvertError(lasterror);
+ return -1;
+ }
+ hFind = (*tclWinProcs->findFirstFileProc)(nativePath, &ffd);
+ if (hFind == INVALID_HANDLE_VALUE) {
+ TclWinConvertError(GetLastError());
+ return -1;
+ }
+ memcpy(&data, &ffd, sizeof(data));
+ FindClose(hFind);
}