diff options
author | dgp <dgp@users.sourceforge.net> | 2006-04-07 14:05:26 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2006-04-07 14:05:26 (GMT) |
commit | f137e44fa1a2dd7603fba62d1b44c103379e2781 (patch) | |
tree | 7aca42ff6117dc5049cbc7b4c2d81fcf3ce9f4c8 /generic | |
parent | ff1aeed46091825a1a52b5f03a39cecde7fbcac9 (diff) | |
download | tcl-f137e44fa1a2dd7603fba62d1b44c103379e2781.zip tcl-f137e44fa1a2dd7603fba62d1b44c103379e2781.tar.gz tcl-f137e44fa1a2dd7603fba62d1b44c103379e2781.tar.bz2 |
* generic/tclPathObj.c: Yet another revised fix for the [Bug 1379287]
* tests/fileSystem.test: family of path normalization bugs.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclPathObj.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 161d7de..ba8d155 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.54 2006/04/06 16:43:03 dgp Exp $ + * RCS: @(#) $Id: tclPathObj.c,v 1.55 2006/04/07 14:05:29 dgp Exp $ */ #include "tclInt.h" @@ -213,13 +213,17 @@ TclFSNormalizeAbsolutePath( /* * Need to skip '.' in the path. */ + int curLen; if (retVal == NULL) { CONST char *path = TclGetString(pathPtr); - retVal = Tcl_NewStringObj(path, dirSep - path - + (dirSep == path)); + retVal = Tcl_NewStringObj(path, dirSep - path); Tcl_IncrRefCount(retVal); } + Tcl_GetStringFromObj(retVal, &curLen); + if (curLen == 0) { + Tcl_AppendToObj(retVal, dirSep, 1); + } dirSep += 2; oldDirSep = dirSep; if (dirSep[0] != 0 && dirSep[1] == '.') { @@ -238,10 +242,13 @@ TclFSNormalizeAbsolutePath( if (retVal == NULL) { CONST char *path = TclGetString(pathPtr); - retVal = Tcl_NewStringObj(path, dirSep - path - + (dirSep == path)); + retVal = Tcl_NewStringObj(path, dirSep - path); Tcl_IncrRefCount(retVal); } + Tcl_GetStringFromObj(retVal, &curLen); + if (curLen == 0) { + Tcl_AppendToObj(retVal, dirSep, 1); + } if (!first || (tclPlatform == TCL_PLATFORM_UNIX)) { link = Tcl_FSLink(retVal, NULL, 0); if (link != NULL) { |