summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-03-19 13:57:30 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-03-19 13:57:30 (GMT)
commit39e89c1b699013af3bb84774a124bb3ce3ae7659 (patch)
treeae83c33f8dd3074761bc81544d8adb80ee00fae3 /win
parentdbafb5fcfcc5e7ccf698b8a0bbfbe7a1eceaaed5 (diff)
parentddc36ee47351940ce5a6909c91bcda6709e5ad70 (diff)
downloadtcl-39e89c1b699013af3bb84774a124bb3ce3ae7659.zip
tcl-39e89c1b699013af3bb84774a124bb3ce3ae7659.tar.gz
tcl-39e89c1b699013af3bb84774a124bb3ce3ae7659.tar.bz2
[Bug 3608360]: Incompatible behaviour of "file exists".
Diffstat (limited to 'win')
-rw-r--r--win/tclWinFile.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 989836f..528b9e5 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -1534,11 +1534,14 @@ NativeAccess(
if (attr == INVALID_FILE_ATTRIBUTES) {
/*
- * 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) {
@@ -1994,8 +1997,17 @@ NativeStat(
if (GetFileAttributesEx(nativePath,
GetFileExInfoStandard, &data) != TRUE) {
- Tcl_SetErrno(ENOENT);
- return -1;
+ HANDLE hFind;
+ WIN32_FIND_DATA ffd;
+ DWORD lasterror = GetLastError();
+
+ if (lasterror != ERROR_SHARING_VIOLATION) {
+ TclWinConvertError(lasterror);
+ return -1;
+ }
+ hFind = FindFirstFile(nativePath, &ffd);
+ memcpy(&data, &ffd, sizeof(data));
+ FindClose(hFind);
}
attr = data.dwFileAttributes;