summaryrefslogtreecommitdiffstats
path: root/generic/tclFileName.c
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2004-03-09 12:56:58 (GMT)
committervincentdarley <vincentdarley>2004-03-09 12:56:58 (GMT)
commit074f543ea2e37afc36c7f281e75575d211bde796 (patch)
tree25c90b5ff17b1204c2f0cf40451ab799d7fd034a /generic/tclFileName.c
parente1afee6bb276d510ee7b22252af4662652500d75 (diff)
downloadtcl-074f543ea2e37afc36c7f281e75575d211bde796.zip
tcl-074f543ea2e37afc36c7f281e75575d211bde796.tar.gz
tcl-074f543ea2e37afc36c7f281e75575d211bde796.tar.bz2
glob -path fix for near filesystem root
Diffstat (limited to 'generic/tclFileName.c')
-rw-r--r--generic/tclFileName.c12
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);