Tcl Source Code

Check-in [f92d60cd3d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:make sure that [file stat] returns the right data, even for locked files.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-4-branch
Files: files | file ages | folders
SHA1: f92d60cd3d3ada948b12084ce02894ba0a2e3815
User & Date: jan.nijtmans 2013-03-19 13:37:40
Context
2013-03-19
14:26
3597000 Consistent [file copy] result. check-in: ef8bec8154 user: dgp tags: core-8-4-branch
13:48
[Bug 2893771]: file stat fails on locked files on win32. check-in: f5ff2ff965 user: jan.nijtmans tags: core-8-5-branch
13:37
make sure that [file stat] returns the right data, even for locked files. check-in: f92d60cd3d user: jan.nijtmans tags: core-8-4-branch
12:43
[Bug 2893771]: file stat fails on locked files on win32. check-in: bfeff04939 user: jan.nijtmans tags: core-8-4-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to win/tclWinFile.c.

1888
1889
1890
1891
1892
1893
1894


1895

1896
1897
1898
1899



1900
1901
1902
1903
1904
1905
1906
	statPtr->st_mtime = ToCTime(data.a.ftLastWriteTime);
	statPtr->st_ctime = ToCTime(data.a.ftCreationTime);
    } else {
	WIN32_FILE_ATTRIBUTE_DATA data;
	if((*tclWinProcs->getFileAttributesExProc)(nativePath,
						   GetFileExInfoStandard,
						   &data) != TRUE) {


	    DWORD lasterror = GetLastError();

	    if (lasterror != ERROR_SHARING_VIOLATION) {
		TclWinConvertError(lasterror);
		return -1;
		}



	}

    
	(*tclWinProcs->getFullPathNameProc)(nativePath, MAX_PATH, 
					    nativeFullPath, &nativePart);

	fullPath = Tcl_WinTCharToUtf((TCHAR *) nativeFullPath, -1, &ds);







>
>

>




>
>
>







1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
	statPtr->st_mtime = ToCTime(data.a.ftLastWriteTime);
	statPtr->st_ctime = ToCTime(data.a.ftCreationTime);
    } else {
	WIN32_FILE_ATTRIBUTE_DATA data;
	if((*tclWinProcs->getFileAttributesExProc)(nativePath,
						   GetFileExInfoStandard,
						   &data) != TRUE) {
	    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);
	}

    
	(*tclWinProcs->getFullPathNameProc)(nativePath, MAX_PATH, 
					    nativeFullPath, &nativePart);

	fullPath = Tcl_WinTCharToUtf((TCHAR *) nativeFullPath, -1, &ds);