diff options
author | vincentdarley <vincentdarley> | 2004-03-09 12:56:58 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2004-03-09 12:56:58 (GMT) |
commit | 83bd3562c6dc32727b2daf5144e64cf1e1b09780 (patch) | |
tree | 25c90b5ff17b1204c2f0cf40451ab799d7fd034a /generic/tclFileName.c | |
parent | bf3eeadcf5c24c56e019e7fe8b20244da6cb05ee (diff) | |
download | tcl-83bd3562c6dc32727b2daf5144e64cf1e1b09780.zip tcl-83bd3562c6dc32727b2daf5144e64cf1e1b09780.tar.gz tcl-83bd3562c6dc32727b2daf5144e64cf1e1b09780.tar.bz2 |
glob -path fix for near filesystem root
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); |