diff options
| author | vincentdarley <vincentdarley> | 2002-10-10 12:25:53 (GMT) | 
|---|---|---|
| committer | vincentdarley <vincentdarley> | 2002-10-10 12:25:53 (GMT) | 
| commit | ac01327196064fd33d463f172cf748c7a0e51c34 (patch) | |
| tree | 53b758745c52382936e9eab9d435276110cf48e6 /unix/tclLoadShl.c | |
| parent | 470eb66b389bd36f18fe1c6b4200565dac236ac8 (diff) | |
| download | tcl-ac01327196064fd33d463f172cf748c7a0e51c34.zip tcl-ac01327196064fd33d463f172cf748c7a0e51c34.tar.gz tcl-ac01327196064fd33d463f172cf748c7a0e51c34.tar.bz2  | |
load fixes for Bug 611108
Diffstat (limited to 'unix/tclLoadShl.c')
| -rw-r--r-- | unix/tclLoadShl.c | 31 | 
1 files changed, 26 insertions, 5 deletions
diff --git a/unix/tclLoadShl.c b/unix/tclLoadShl.c index 84ef9fa..60919a7 100644 --- a/unix/tclLoadShl.c +++ b/unix/tclLoadShl.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: tclLoadShl.c,v 1.12 2002/07/18 16:26:04 vincentdarley Exp $ + * RCS: @(#) $Id: tclLoadShl.c,v 1.13 2002/10/10 12:25:53 vincentdarley Exp $   */  #include <dl.h> @@ -57,8 +57,9 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)  				 * this file. */  {      shl_t handle; +    CONST char *native;      char *fileName = Tcl_GetString(pathPtr); -     +      /*       * The flags below used to be BIND_IMMEDIATE; they were changed at       * the suggestion of Wolfgang Kechel (wolfgang@prs.de): "This @@ -69,9 +70,29 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr)       * when they are build."       */ -    handle = shl_load(fileName, -		      BIND_DEFERRED|BIND_VERBOSE|DYNAMIC_PATH, -		      0L); + +    /*  +     * 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); +    handle = shl_load(native, +		      BIND_DEFERRED|BIND_VERBOSE|DYNAMIC_PATH, 0L); +     +    if (handle == NULL) { +	/*  +	 * 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); +	handle = shl_load(native, +			  BIND_DEFERRED|BIND_VERBOSE|DYNAMIC_PATH, 0L); +	Tcl_DStringFree(&ds); +    } +      if (handle == NULL) {  	Tcl_AppendResult(interp, "couldn't load file \"", fileName,  		"\": ", Tcl_PosixError(interp), (char *) NULL);  | 
