diff options
author | vincentdarley <vincentdarley@noemail.net> | 2004-03-09 12:56:58 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley@noemail.net> | 2004-03-09 12:56:58 (GMT) |
commit | f55921e0b5157aca4936b5c52cba5917fe0cfc80 (patch) | |
tree | 25c90b5ff17b1204c2f0cf40451ab799d7fd034a /generic/tclFileName.c | |
parent | 991e36ef62956668f526b196bbcb58ea3eaf43ba (diff) | |
download | tcl-f55921e0b5157aca4936b5c52cba5917fe0cfc80.zip tcl-f55921e0b5157aca4936b5c52cba5917fe0cfc80.tar.gz tcl-f55921e0b5157aca4936b5c52cba5917fe0cfc80.tar.bz2 |
glob -path fix for near filesystem root
FossilOrigin-Name: b16129b8db5687617d5dbe3a74e29d9b46792767
Diffstat (limited to 'generic/tclFileName.c')
-rw-r--r-- | generic/tclFileName.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/generic/tclFileName.c b/generic/tclFileName.c index bc314cf..7fbfb7f 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.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: tclFileName.c,v 1.40.2.6 2004/01/13 17:26:42 dgp Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.40.2.7 2004/03/09 12:56:59 vincentdarley Exp $ */ #include "tclInt.h" @@ -1717,6 +1717,16 @@ Tcl_GlobObjCmd(dummy, interp, objc, objv) /* Have to split off the end */ Tcl_DStringAppend(&pref, last, first+pathlength-last); pathOrDir = Tcl_NewStringObj(first, last-first-1); + /* + * We must ensure that we haven't cut off too much, + * and turned a valid path like '/' or 'C:/' into + * an incorrect path like '' or 'C:'. The way we + * do this is to add a separator if there are none + * presently in the prefix. + */ + if (strpbrk(Tcl_GetString(pathOrDir), "\\/") == NULL) { + Tcl_AppendToObj(pathOrDir, last-1, 1); + } } /* Need to quote 'prefix' */ Tcl_DStringInit(&prefix); |