summaryrefslogtreecommitdiffstats
path: root/generic/tclPathObj.c
diff options
context:
space:
mode:
authordgp@users.sourceforge.net <dgp>2012-08-20 23:45:25 (GMT)
committerdgp@users.sourceforge.net <dgp>2012-08-20 23:45:25 (GMT)
commit7dc83ee2161ff6870f219fca0191c38daa7a32e5 (patch)
tree6e5cb95f331e942f7ff8815b86c65862fd1e90fc /generic/tclPathObj.c
parentcf9d0edf00d841115d8d92b7fe58c0e92a908a08 (diff)
downloadtcl-7dc83ee2161ff6870f219fca0191c38daa7a32e5.zip
tcl-7dc83ee2161ff6870f219fca0191c38daa7a32e5.tar.gz
tcl-7dc83ee2161ff6870f219fca0191c38daa7a32e5.tar.bz2
3559678 Fix bad filename normalization when the last component is the empty string.
Diffstat (limited to 'generic/tclPathObj.c')
-rw-r--r--generic/tclPathObj.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index ac9df3a..c9b3b8e 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -1831,7 +1831,7 @@ Tcl_FSGetNormalizedPath(
*/
Tcl_Obj *dir, *copy;
- int cwdLen, pathType;
+ int tailLen, cwdLen, pathType;
pathType = Tcl_FSGetPathType(fsPathPtr->cwdPtr);
dir = Tcl_FSGetNormalizedPath(interp, fsPathPtr->cwdPtr);
@@ -1843,7 +1843,12 @@ Tcl_FSGetNormalizedPath(
UpdateStringOfFsPath(pathPtr);
}
- copy = AppendPath(dir, fsPathPtr->normPathPtr);
+ Tcl_GetStringFromObj(fsPathPtr->normPathPtr, &tailLen);
+ if (tailLen) {
+ copy = AppendPath(dir, fsPathPtr->normPathPtr);
+ } else {
+ copy = Tcl_DuplicateObj(dir);
+ }
Tcl_IncrRefCount(dir);
Tcl_IncrRefCount(copy);