summaryrefslogtreecommitdiffstats
path: root/generic/tclFileName.c
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2003-04-29 11:45:22 (GMT)
committervincentdarley <vincentdarley>2003-04-29 11:45:22 (GMT)
commit8fb4b544191b41c53d33158bd500989d683eae03 (patch)
tree90d2eeb2fccce449fd2543da405b6b0e090677ea /generic/tclFileName.c
parent9e3a21b5ebf1b620acfd51cef82cd549b83ed815 (diff)
downloadtcl-8fb4b544191b41c53d33158bd500989d683eae03.zip
tcl-8fb4b544191b41c53d33158bd500989d683eae03.tar.gz
tcl-8fb4b544191b41c53d33158bd500989d683eae03.tar.bz2
glob and square brackets fix
Diffstat (limited to 'generic/tclFileName.c')
-rw-r--r--generic/tclFileName.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index 16bf9d0..4a9a0b6 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 2003/01/09 10:01:59 vincentdarley Exp $
+ * RCS: @(#) $Id: tclFileName.c,v 1.40.2.1 2003/04/29 11:45:24 vincentdarley Exp $
*/
#include "tclInt.h"
@@ -2330,8 +2330,19 @@ TclDoGlob(interp, separators, headPtr, tail, types)
count = 0;
name = tail;
for (; *tail != '\0'; tail++) {
- if ((*tail == '\\') && (strchr(separators, tail[1]) != NULL)) {
- tail++;
+ if (*tail == '\\') {
+ /*
+ * If the first character is escaped, either we have a directory
+ * separator, or we have any other character. In the latter case
+ * the rest of tail is a pattern, and we must break from the loop.
+ * This is particularly important on Windows where '\' is both
+ * the escaping character and a directory separator.
+ */
+ if (strchr(separators, tail[1]) != NULL) {
+ tail++;
+ } else {
+ break;
+ }
} else if (strchr(separators, *tail) == NULL) {
break;
}