diff options
author | vincentdarley <vincentdarley@noemail.net> | 2002-10-10 12:25:52 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley@noemail.net> | 2002-10-10 12:25:52 (GMT) |
commit | 91bb0051e7d19c110afa67bd8e0ebafa052edcdc (patch) | |
tree | 53b758745c52382936e9eab9d435276110cf48e6 /unix/tclLoadOSF.c | |
parent | afdb69445888c884ed001e631ecbfd387496c98f (diff) | |
download | tcl-91bb0051e7d19c110afa67bd8e0ebafa052edcdc.zip tcl-91bb0051e7d19c110afa67bd8e0ebafa052edcdc.tar.gz tcl-91bb0051e7d19c110afa67bd8e0ebafa052edcdc.tar.bz2 |
load fixes for Bug 611108
FossilOrigin-Name: 4a2a8cda84e8705e04c0b6b3b5a9d8e445298b35
Diffstat (limited to 'unix/tclLoadOSF.c')
-rw-r--r-- | unix/tclLoadOSF.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/unix/tclLoadOSF.c b/unix/tclLoadOSF.c index 7e7c6d4..308c55d 100644 --- a/unix/tclLoadOSF.c +++ b/unix/tclLoadOSF.c @@ -31,7 +31,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLoadOSF.c,v 1.10 2002/07/18 16:26:04 vincentdarley Exp $ + * RCS: @(#) $Id: tclLoadOSF.c,v 1.11 2002/10/10 12:25:53 vincentdarley Exp $ */ #include "tclInt.h" @@ -72,8 +72,28 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr) ldr_module_t lm; char *pkg; char *fileName = Tcl_GetString(pathPtr); + CONST char *native; + + /* + * First try the full path the user gave us. This is particularly + * important if the cwd is inside a vfs, and we are trying to load + * using a relative path. + */ + native = Tcl_FSGetNativePath(pathPtr); + lm = (Tcl_PackageInitProc *) load(native, LDR_NOFLAGS); + + if (lm == LDR_NULL_MODULE) { + /* + * Let the OS loader examine the binary search path for + * whatever string the user gave us which hopefully refers + * to a file on the binary path + */ + Tcl_DString ds; + native = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds); + lm = (Tcl_PackageInitProc *) load(native, LDR_NOFLAGS); + Tcl_DStringFree(&ds); + } - lm = (Tcl_PackageInitProc *) load(fileName, LDR_NOFLAGS); if (lm == LDR_NULL_MODULE) { Tcl_AppendResult(interp, "couldn't load file \"", fileName, "\": ", Tcl_PosixError (interp), (char *) NULL); |