From: Zoran V. <vas...@us...> - 2005-10-22 08:27:02
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21207/nsd Modified Files: modload.c Log Message: Make the passed file path absolute before attempting to load the module. Index: modload.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/modload.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** modload.c 21 Oct 2005 06:50:11 -0000 1.8 --- modload.c 22 Oct 2005 08:26:52 -0000 1.9 *************** *** 125,130 **** * Ns_ModuleLoad -- * ! * Load a module and initialize it. The result code from modules ! * without the version symbol are ignored. * * Results: --- 125,129 ---- * Ns_ModuleLoad -- * ! * Load a module and initialize it. * * Results: *************** *** 132,136 **** * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 131,135 ---- * * Side effects: ! * The result code from modules w/o the version symbol is ignored * *---------------------------------------------------------------------- *************** *** 143,146 **** --- 142,146 ---- Tcl_PackageInitProc *tclInitProc = NULL, *tclVerProc = NULL; Ns_ModuleInitProc *initProc = NULL; + Ns_DString ds; int status, *verPtr = NULL; Tcl_Obj *pathObj; *************** *** 151,159 **** Ns_Log(Notice, "modload: loading %s", file); pathObj = Tcl_NewStringObj(file, -1); Tcl_IncrRefCount(pathObj); if (Tcl_FSGetNormalizedPath(NULL, pathObj) == NULL) { - Tcl_DecrRefCount(pathObj); Ns_Log(Error, "modload: %s: invalid path", file); return NS_ERROR; } --- 151,165 ---- Ns_Log(Notice, "modload: loading %s", file); + Ns_DStringInit(&ds); + if (!Ns_PathIsAbsolute(file)) { + file = Ns_HomePath(&ds, "bin", file, NULL); + } pathObj = Tcl_NewStringObj(file, -1); + Tcl_IncrRefCount(pathObj); if (Tcl_FSGetNormalizedPath(NULL, pathObj) == NULL) { Ns_Log(Error, "modload: %s: invalid path", file); + Tcl_DecrRefCount(pathObj); + Ns_DStringFree(&ds); return NS_ERROR; } *************** *** 166,169 **** --- 172,176 ---- Ns_Log(Error, "modload: %s: %s", file, Tcl_GetStringResult(interp)); Tcl_DeleteInterp(interp); + Ns_DStringFree(&ds); return NS_ERROR; } *************** *** 175,181 **** --- 182,191 ---- if (initProc == NULL) { Ns_Log(Error, "modload: %s: %s: symbol not found", file, init); + Ns_DStringFree(&ds); return NS_ERROR; } + status = (*initProc)(server, module); + if (verPtr == NULL || *verPtr < 1) { status = NS_OK; *************** *** 184,187 **** --- 194,199 ---- } + Ns_DStringFree(&ds); + return status; } |