diff options
author | dgp <dgp@noemail.net> | 2003-11-10 20:34:10 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2003-11-10 20:34:10 (GMT) |
commit | a8aaa66e8e46c6e14dcde3412010a6a5ca03ab24 (patch) | |
tree | cd0670715ebd514c77d2894bd372f15b2a7f3bac /win | |
parent | e4fe65aac2bf99998120e5355f0c2a8b3fb4860a (diff) | |
download | tcl-a8aaa66e8e46c6e14dcde3412010a6a5ca03ab24.zip tcl-a8aaa66e8e46c6e14dcde3412010a6a5ca03ab24.tar.gz tcl-a8aaa66e8e46c6e14dcde3412010a6a5ca03ab24.tar.bz2 |
* unix/tclUnixInit.c (TclpInitLibraryPath):
* win/tclWinInit.c (TclpInitLibraryPath): Fix for [Bug 832657]
that should not run afoul of startup constraints.
FossilOrigin-Name: 5d17bf7a052eb00dc15a7da39f924ce86b5c3591
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinInit.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 65ca7d1..d84925b 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -7,7 +7,7 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclWinInit.c,v 1.42 2003/08/06 23:48:42 hobbs Exp $ + * RCS: @(#) $Id: tclWinInit.c,v 1.43 2003/11/10 20:34:17 dgp Exp $ */ #include "tclWinInt.h" @@ -197,7 +197,7 @@ TclpInitLibraryPath(path) */ sprintf(installLib, "lib/tcl%s", TCL_VERSION); - sprintf(developLib, "../tcl%s/library", TCL_PATCH_LEVEL); + sprintf(developLib, "tcl%s/library", TCL_PATCH_LEVEL); /* * Look for the library relative to default encoding dir. @@ -252,7 +252,25 @@ TclpInitLibraryPath(path) */ 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; @@ -307,6 +325,7 @@ TclpInitLibraryPath(path) Tcl_ListObjAppendElement(NULL, pathPtr, objPtr); Tcl_DStringFree(&ds); } + ckfree((char *) origv); ckfree((char *) pathv); } |