summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2006-03-03 20:10:07 (GMT)
committerdgp <dgp@users.sourceforge.net>2006-03-03 20:10:07 (GMT)
commit582550ff6d9cb4106e887545d6fa3805303de2c1 (patch)
tree2c5098fc0a848afcd5b6976b1a25bc3a6c4602d0 /generic
parent123991e14661143522122cc5441e238b679414e3 (diff)
downloadtcl-582550ff6d9cb4106e887545d6fa3805303de2c1.zip
tcl-582550ff6d9cb4106e887545d6fa3805303de2c1.tar.gz
tcl-582550ff6d9cb4106e887545d6fa3805303de2c1.tar.bz2
* generic/tclPathObj.c: Revised yesterday's fix for [Bug 1379287]
to work on Windows.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclPathObj.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index 0cc577b..be530f5 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclPathObj.c,v 1.50 2006/03/03 04:32:11 dgp Exp $
+ * RCS: @(#) $Id: tclPathObj.c,v 1.51 2006/03/03 20:10:09 dgp Exp $
*/
#include "tclInt.h"
@@ -162,8 +162,9 @@ TclFSNormalizeAbsolutePath(
int first = 1; /* Set to zero once we've passed the first
* directory separator - we can't use '..' to
* remove the volume in a path. */
+ int rootOffset;
Tcl_Obj *retVal = NULL;
- dirSep = TclGetString(pathPtr);
+ oldDirSep = dirSep = TclGetString(pathPtr);
if (tclPlatform == TCL_PLATFORM_WINDOWS) {
if (dirSep[0] != 0 && dirSep[1] == ':' &&
@@ -191,6 +192,7 @@ TclFSNormalizeAbsolutePath(
* since we will have to expand the link to be able to back up one level.
*/
+ rootOffset = dirSep - oldDirSep;
while (*dirSep != 0) {
oldDirSep = dirSep;
if (!first) {
@@ -318,9 +320,9 @@ TclFSNormalizeAbsolutePath(
if (curLen == 0) {
/* Attempt to .. beyond root becomes root: "/" */
if (dirSep[3] != 0) {
- Tcl_SetObjLength(retVal, 0);
+ Tcl_SetObjLength(retVal, rootOffset);
} else {
- Tcl_SetObjLength(retVal, 1);
+ Tcl_SetObjLength(retVal, rootOffset+1);
}
}
}