summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2003-11-10 20:34:11 (GMT)
committerdgp <dgp@users.sourceforge.net>2003-11-10 20:34:11 (GMT)
commitf38d3f45e484452ba99ef07b5348e2c479650d4a (patch)
treecd0670715ebd514c77d2894bd372f15b2a7f3bac /unix
parent3b1188db0613694c7f2529386464c9ef96e8bca3 (diff)
downloadtcl-f38d3f45e484452ba99ef07b5348e2c479650d4a.zip
tcl-f38d3f45e484452ba99ef07b5348e2c479650d4a.tar.gz
tcl-f38d3f45e484452ba99ef07b5348e2c479650d4a.tar.bz2
* unix/tclUnixInit.c (TclpInitLibraryPath):
* win/tclWinInit.c (TclpInitLibraryPath): Fix for [Bug 832657] that should not run afoul of startup constraints.
Diffstat (limited to 'unix')
-rw-r--r--unix/tclUnixInit.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 53853df..ea9b95a 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -7,7 +7,7 @@
* Copyright (c) 1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tclUnixInit.c,v 1.35 2003/05/13 08:40:31 das Exp $
+ * RCS: @(#) $Id: tclUnixInit.c,v 1.36 2003/11/10 20:34:15 dgp Exp $
*/
#if defined(HAVE_CFBUNDLE)
@@ -338,7 +338,25 @@ CONST char *path; /* Path to the executable in native
*/
if (path != NULL) {
- Tcl_SplitPath(path, &pathc, &pathv);
+ int i, origc;
+ CONST char **origv;
+
+ Tcl_SplitPath(path, &origc, &origv);
+ pathc = 0;
+ pathv = (CONST char **) ckalloc((unsigned int)(origc * sizeof(char *)));
+ for (i=0; i< origc; i++) {
+ if (origv[i][0] == '.') {
+ if (strcmp(origv[i], ".") == 0) {
+ /* do nothing */
+ } else if (strcmp(origv[i], "..") == 0) {
+ pathc--;
+ } else {
+ pathv[pathc++] = origv[i];
+ }
+ } else {
+ pathv[pathc++] = origv[i];
+ }
+ }
if (pathc > 2) {
str = pathv[pathc - 2];
pathv[pathc - 2] = installLib;
@@ -393,6 +411,7 @@ CONST char *path; /* Path to the executable in native
Tcl_ListObjAppendElement(NULL, pathPtr, objPtr);
Tcl_DStringFree(&ds);
}
+ ckfree((char *) origv);
ckfree((char *) pathv);
}