diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-01-08 10:13:20 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-01-08 10:13:20 (GMT) |
commit | dd0ed45dbbbde948f970ecd86ec65db25c417614 (patch) | |
tree | 32bd852591e380baee185561395763b25162866b /win/tclWinFile.c | |
parent | 8533669f18b97432085b45d77d1d3762b11e9da0 (diff) | |
parent | e4b4a00f1760c77a821c7508cd72aeb45d0d8b75 (diff) | |
download | tcl-dd0ed45dbbbde948f970ecd86ec65db25c417614.zip tcl-dd0ed45dbbbde948f970ecd86ec65db25c417614.tar.gz tcl-dd0ed45dbbbde948f970ecd86ec65db25c417614.tar.bz2 |
[Bug 3092089]: [file normalize] can remove path components.
[Bug 3587096] win vista/7: "can't find init.tcl" when called via junction.
Diffstat (limited to 'win/tclWinFile.c')
-rw-r--r-- | win/tclWinFile.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 69d1838..4abd215 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -181,7 +181,7 @@ static int NativeStat(CONST TCHAR *path, Tcl_StatBuf *statPtr, int checkLinks); static unsigned short NativeStatMode(DWORD attr, int checkLinks, int isExec); static int NativeIsExec(CONST TCHAR *path); static int NativeReadReparse(CONST TCHAR* LinkDirectory, - REPARSE_DATA_BUFFER* buffer); + REPARSE_DATA_BUFFER* buffer, DWORD desiredAccess); static int NativeWriteReparse(CONST TCHAR* LinkDirectory, REPARSE_DATA_BUFFER* buffer); static int NativeMatchType(int isDrive, DWORD attr, CONST TCHAR* nativeName, @@ -395,7 +395,7 @@ TclWinSymLinkCopyDirectory(LinkOriginal, LinkCopy) DUMMY_REPARSE_BUFFER dummy; REPARSE_DATA_BUFFER *reparseBuffer = (REPARSE_DATA_BUFFER*)&dummy; - if (NativeReadReparse(LinkOriginal, reparseBuffer)) { + if (NativeReadReparse(LinkOriginal, reparseBuffer, GENERIC_READ)) { return -1; } return NativeWriteReparse(LinkCopy, reparseBuffer); @@ -479,7 +479,7 @@ WinReadLinkDirectory(LinkDirectory) Tcl_SetErrno(EINVAL); return NULL; } - if (NativeReadReparse(LinkDirectory, reparseBuffer)) { + if (NativeReadReparse(LinkDirectory, reparseBuffer, 0)) { return NULL; } @@ -585,14 +585,15 @@ WinReadLinkDirectory(LinkDirectory) *-------------------------------------------------------------------- */ static int -NativeReadReparse(LinkDirectory, buffer) +NativeReadReparse(LinkDirectory, buffer, desiredAccess) CONST TCHAR* LinkDirectory; /* The junction to read */ REPARSE_DATA_BUFFER* buffer; /* Pointer to buffer. Cannot be NULL */ + DWORD desiredAccess; { HANDLE hFile; DWORD returnedLength; - hFile = (*tclWinProcs->createFileProc)(LinkDirectory, GENERIC_READ, 0, + hFile = (*tclWinProcs->createFileProc)(LinkDirectory, desiredAccess, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL); if (hFile == INVALID_HANDLE_VALUE) { |