summaryrefslogtreecommitdiffstats
path: root/win/tclWinFile.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-03-19 13:48:37 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-03-19 13:48:37 (GMT)
commit01ae22053af8cd618c105c63909fa6386f316bbc (patch)
treeb98cf0261f632507519e0f2c89046224feb09eac /win/tclWinFile.c
parent5c41a9fc8aa1f968ef6bbf23f5713c1341d8d057 (diff)
parentf02a6bd750b0c1da6b070dc9faf45562fa1c560d (diff)
downloadtcl-01ae22053af8cd618c105c63909fa6386f316bbc.zip
tcl-01ae22053af8cd618c105c63909fa6386f316bbc.tar.gz
tcl-01ae22053af8cd618c105c63909fa6386f316bbc.tar.bz2
[Bug 2893771]: file stat fails on locked files on win32.
Diffstat (limited to 'win/tclWinFile.c')
-rw-r--r--win/tclWinFile.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 3817fa4..b5e104f 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -1543,11 +1543,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) {
@@ -2046,8 +2049,17 @@ NativeStat(
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);
+ memcpy(&data, &ffd, sizeof(data));
+ FindClose(hFind);
}
attr = data.dwFileAttributes;