From 43370bff5cc09fd779d82af1724915947ebbeb62 Mon Sep 17 00:00:00 2001 From: gneumann <> Date: Fri, 20 Jun 2008 08:06:33 +0000 Subject: [PATCH] remove direct access to interp->result, initializing potentially uninitialized variables --- ChangeLog | 10 ++++++++++ nscp/nscp.c | 4 ++-- nsd/tclloop.c | 4 ++-- nsd/tclshare.c | 4 ++-- nsproxy/nsproxylib.c | 11 +++++------ 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 78ad724..224d79c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-06-20 Gustaf Neumann + + * remove direct access to interp->result in + - nscp/nscp.c + - nsd/tclloop.c + - nsd/tclshare.c + - nsproxy/nsproxylib.c + * initializing potentially uninitialized variables in + - nsproxy/nsproxylib.c + 2008-05-13 Jeff Rogers * configure.in: add -nostartfiles flag to link line when -shared diff --git a/nscp/nscp.c b/nscp/nscp.c index 7daff35..75a3b8b 100644 --- a/nscp/nscp.c +++ b/nscp/nscp.c @@ -35,7 +35,7 @@ * Tcl commands. */ -static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nscp/nscp.c,v 1.24 2005/08/08 15:32:34 jgdavidson Exp $, compiled: " __DATE__ " " __TIME__; +static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nscp/nscp.c,v 1.25 2008/06/20 08:06:32 gneumann Exp $, compiled: " __DATE__ " " __TIME__; #include "ns.h" @@ -363,7 +363,7 @@ EvalThread(void *arg) Ns_TclLogError(interp); } Tcl_AppendResult(interp, "\r\n", NULL); - res = interp->result; + res = Tcl_GetStringResult(interp); len = strlen(res); while (len > 0) { if ((n = send(sessPtr->sock, res, len, 0)) <= 0) goto done; diff --git a/nsd/tclloop.c b/nsd/tclloop.c index 279f4ac..27fb41d 100644 --- a/nsd/tclloop.c +++ b/nsd/tclloop.c @@ -34,7 +34,7 @@ * monitored and managed by "ns_loop_ctl" command. */ -static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsd/tclloop.c,v 1.2 2006/06/02 18:51:49 jgdavidson Exp $, compiled: " __DATE__ " " __TIME__; +static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsd/tclloop.c,v 1.3 2008/06/20 08:06:32 gneumann Exp $, compiled: " __DATE__ " " __TIME__; #include "nsd.h" @@ -853,7 +853,7 @@ CheckControl(NsServer *servPtr, Tcl_Interp *interp, LoopData *dataPtr) } Ns_MutexLock(&servPtr->tcl.llock); if (dataPtr->evalPtr == NULL) { - Ns_Log(Error, "loopctl: dropped result: %s", interp->result); + Ns_Log(Error, "loopctl: dropped result: %s", Tcl_GetStringResult(interp)); } else { str = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), &len); Tcl_DStringAppend(&dataPtr->evalPtr->result, str, len); diff --git a/nsd/tclshare.c b/nsd/tclshare.c index 286aa3d..1aa4145 100644 --- a/nsd/tclshare.c +++ b/nsd/tclshare.c @@ -223,7 +223,7 @@ ShareVar(NsInterp *itPtr, Tcl_Interp *interp, char *varName) return TCL_ERROR; } - if (strcmp(interp->result, "1") == 0) { + if (strcmp(Tcl_GetStringResult(interp), "1") == 0) { /* * Get existing value in variable being shared. */ @@ -246,7 +246,7 @@ ShareVar(NsInterp *itPtr, Tcl_Interp *interp, char *varName) char **argv; int x; Tcl_InitHashTable(&valuePtr->array, TCL_STRING_KEYS); - if (Tcl_SplitList(interp, interp->result, &argc, + if (Tcl_SplitList(interp, Tcl_GetStringResult(interp), &argc, (CONST char***)&argv) == TCL_OK) { for (x = 0; x < argc; x += 2) { Tcl_HashEntry* newEntry; diff --git a/nsproxy/nsproxylib.c b/nsproxy/nsproxylib.c index ae84680..6e055f9 100755 --- a/nsproxy/nsproxylib.c +++ b/nsproxy/nsproxylib.c @@ -33,7 +33,7 @@ * Library for ns_proxy commands and main loops. */ -static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsproxy/nsproxylib.c,v 1.6 2007/05/11 22:11:59 shmooved Exp $, compiled: " __DATE__ " " __TIME__; +static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsproxy/nsproxylib.c,v 1.7 2008/06/20 08:06:33 gneumann Exp $, compiled: " __DATE__ " " __TIME__; #include "nsproxy.h" #include @@ -280,7 +280,7 @@ Ns_ProxyMain(int argc, char **argv, Tcl_AppInitProc *init) { Tcl_Interp *interp; Proc proc; - int result, len, n, max; + int result, len, n, max = 0; Req *reqPtr; Tcl_DString in, out; char *script, *active, *dots; @@ -329,7 +329,7 @@ Ns_ProxyMain(int argc, char **argv, Tcl_AppInitProc *init) interp = Ns_TclCreateInterp(); if (init != NULL) { if ((*init)(interp) != TCL_OK) { - FatalExit(interp->result); + FatalExit(Tcl_GetStringResult(interp)); } } @@ -1460,7 +1460,7 @@ static void Export(Tcl_Interp *interp, int code, Tcl_DString *dsPtr) { Res hdr; - char *einfo, *ecode, *result; + char *einfo = NULL, *ecode = NULL, *result; int clen, ilen, rlen; clen = ilen = rlen = 0; @@ -1898,9 +1898,8 @@ FatalExit(char *func) static char * ProxyError(Tcl_Interp *interp, Err err) { - char *msg, *sysmsg, *code; + char *msg = NULL, *sysmsg = NULL, *code = NULL; - sysmsg = NULL; switch (err) { case ENone: code = "ENone";