summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2004-04-01 11:13:00 (GMT)
committervincentdarley <vincentdarley>2004-04-01 11:13:00 (GMT)
commitfcc8d73fc63d034e3e01c6b0a98935e9da182a18 (patch)
tree209477399ab57d00fcf5805625fd22d31f9434f3 /generic
parent64a1c946139f5b56887f39a4ab6230d9acbb37bc (diff)
downloadtcl-fcc8d73fc63d034e3e01c6b0a98935e9da182a18.zip
tcl-fcc8d73fc63d034e3e01c6b0a98935e9da182a18.tar.gz
tcl-fcc8d73fc63d034e3e01c6b0a98935e9da182a18.tar.bz2
cross-filesystem boundary glob fix
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIOUtil.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 52bec32..e82efa5 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -17,7 +17,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIOUtil.c,v 1.97 2004/03/30 15:35:46 vincentdarley Exp $
+ * RCS: @(#) $Id: tclIOUtil.c,v 1.98 2004/04/01 11:13:01 vincentdarley Exp $
*/
#include "tclInt.h"
@@ -1161,13 +1161,30 @@ FsAddMountsToGlobResult(result, pathPtr, pattern, types)
}
}
if (!found && dir) {
+ int len, mlen;
+ CONST char *path;
+ CONST char *mount;
if (Tcl_IsShared(result)) {
Tcl_Obj *newList;
newList = Tcl_DuplicateObj(result);
Tcl_DecrRefCount(result);
result = newList;
}
- Tcl_ListObjAppendElement(NULL, result, mElt);
+ /*
+ * We know mElt is absolute normalized and lies inside pathPtr,
+ * so now we must add to the result the right
+ * representation of mElt, i.e. the representation which
+ * is relative to pathPtr.
+ */
+ mount = Tcl_GetStringFromObj(mElt, &mlen);
+ path = Tcl_GetStringFromObj(Tcl_FSGetNormalizedPath(NULL, pathPtr),
+ &len);
+ if (path[len-1] == '/') {
+ /* Deal with the root of the volume */
+ len--;
+ }
+ mElt = TclNewFSPathObj(pathPtr, mount + len + 1, mlen - len);
+ Tcl_ListObjAppendElement(NULL, result, mElt);
/*
* No need to increment gLength, since we
* don't want to compare mounts against