Attachment "tclLoadDl.c.patch" to
ticket [1503729fff]
added by
kenstir
2006-06-10 04:09:08.
--- sync://src.matrixone.net:2647/Projects/SyncInc/vendor/tcl/tcl8.4.2/unix/tclLoadDl.c;1.3
+++ file:///home/ken/build/rel50/src/vendor/tcl/tcl8.4.2/unix/tclLoadDl.c
@@ -68,6 +68,7 @@
{
VOID *handle;
CONST char *native;
+ CONST char *err = NULL;
/*
* First try the full path the user gave us. This is particularly
@@ -86,13 +87,19 @@
char *fileName = Tcl_GetString(pathPtr);
native = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds);
handle = dlopen(native, RTLD_NOW | RTLD_GLOBAL);
+ /* After a failed dlopen(), you have to call dlerror() before any
+ other dynamic linking activity. */
+ if (handle == NULL)
+ err = strdup(dlerror());
Tcl_DStringFree(&ds);
}
if (handle == NULL) {
Tcl_AppendResult(interp, "couldn't load file \"",
Tcl_GetString(pathPtr),
- "\": ", dlerror(), (char *) NULL);
+ "\": ", err ? err : "<unknown error>", (char *) NULL);
+ if (err)
+ free((void*)err);
return TCL_ERROR;
}