summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclPathObj.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index 9ed241a..0cc577b 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.49 2006/01/12 18:35:28 vasiljevic Exp $
+ * RCS: @(#) $Id: tclPathObj.c,v 1.50 2006/03/03 04:32:11 dgp Exp $
*/
#include "tclInt.h"
@@ -309,12 +309,20 @@ TclFSNormalizeAbsolutePath(
* Either way, we now remove the last path element.
*/
- while (--curLen >= 0) {
+ while (--curLen > 0) {
if (IsSeparatorOrNull(linkStr[curLen])) {
Tcl_SetObjLength(retVal, curLen);
break;
}
}
+ if (curLen == 0) {
+ /* Attempt to .. beyond root becomes root: "/" */
+ if (dirSep[3] != 0) {
+ Tcl_SetObjLength(retVal, 0);
+ } else {
+ Tcl_SetObjLength(retVal, 1);
+ }
+ }
}
dirSep += 3;
oldDirSep = dirSep;