summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-12-16 13:00:27 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2010-12-16 13:00:27 +0100
commit4da2cbcae7d55a1a9877b3eee4cbce5bb2540a21 (patch)
tree70b8123a9d7d648fe007e8f6c01466e9b26fd4e1
parentc4c20c18aae7c95c1e69c10d2ea9efbc3c2c1913 (diff)
parent371a8eec29fa25bbf58f4b1f0d7e3bf4c3ad6329 (diff)
downloadrsyslog-4da2cbcae7d55a1a9877b3eee4cbce5bb2540a21.tar.gz
rsyslog-4da2cbcae7d55a1a9877b3eee4cbce5bb2540a21.tar.xz
rsyslog-4da2cbcae7d55a1a9877b3eee4cbce5bb2540a21.zip
Merge branch 'v4-stable' into v4-devel
Conflicts: runtime/parser.c
-rw-r--r--ChangeLog7
-rw-r--r--doc/rsyslog_conf_filter.html4
-rw-r--r--plugins/imklog/ksym.c4
-rw-r--r--runtime/cfsysline.c4
-rw-r--r--runtime/conf.c2
-rw-r--r--runtime/ctok.c4
-rw-r--r--runtime/debug.c6
-rw-r--r--runtime/msg.c4
-rw-r--r--runtime/parser.c2
-rw-r--r--runtime/queue.c5
-rw-r--r--runtime/wtp.c2
-rw-r--r--template.c10
-rw-r--r--threads.c3
-rw-r--r--tools/omfile.c1
-rw-r--r--tools/omfwd.c2
-rw-r--r--tools/omusrmsg.c1
-rw-r--r--tools/rsyslog.conf.54
-rw-r--r--tools/syslogd.c2
18 files changed, 28 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index bbf900fa..0982b77a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -73,6 +73,10 @@ Version 4.6.6 [v4-stable] (rgerhards), 2010-11-??
- bugfix: imfile utilizes 32 bit to track offset. Most importantly,
this problem can not experienced on Fedora 64 bit OS (which has
64 bit long's!)
+- some improvements thanks to clang's static code analyzer
+ o overall cleanup (mostly unnecessary writes and otherwise unused stuff)
+ o bugfix: fixed a very remote problem in msg.c which could occur when
+ running under extremely low memory conditions
---------------------------------------------------------------------------
Version 4.6.5 [v4-stable] (rgerhards), 2010-11-24
- bugfix(important): problem in TLS handling could cause rsyslog to loop
@@ -707,6 +711,9 @@ version before switching to this one.
- bugfix: memory leak in ompgsql
Thanks to Ken for providing the patch
---------------------------------------------------------------------------
+Version 3.22.4 [v3-stable] (rgerhards), 2010-??-??
+- improved some code based on clang static analyzer results
+---------------------------------------------------------------------------
Version 3.22.3 [v3-stable] (rgerhards), 2010-11-24
- bugfix(important): problem in TLS handling could cause rsyslog to loop
in a tight loop, effectively disabling functionality and bearing the
diff --git a/doc/rsyslog_conf_filter.html b/doc/rsyslog_conf_filter.html
index 63c29817..34839616 100644
--- a/doc/rsyslog_conf_filter.html
+++ b/doc/rsyslog_conf_filter.html
@@ -85,12 +85,12 @@ selector field is capable to overwrite the preceding ones. Using this
behavior you can exclude some priorities from the pattern.</p>
<p>Rsyslogd has a syntax extension to the original BSD source,
that makes its use more intuitively. You may precede every priority
-with an equation sign ("='') to specify only this single priority and
+with an equals sign ("='') to specify only this single priority and
not any of the above. You may also (both is valid, too) precede the
priority with an exclamation mark ("!'') to ignore all that
priorities, either exact this one or this and any higher priority. If
you use both extensions than the exclamation mark must occur before the
-equation sign, just use it intuitively.</p>
+equals sign, just use it intuitively.</p>
<h3>Property-Based Filters</h3>
<p>Property-based filters are unique to rsyslogd. They allow to
filter on any property, like HOSTNAME, syslogtag and msg. A list of all
diff --git a/plugins/imklog/ksym.c b/plugins/imklog/ksym.c
index f636a7bb..ca708ba6 100644
--- a/plugins/imklog/ksym.c
+++ b/plugins/imklog/ksym.c
@@ -650,8 +650,7 @@ static void FreeSymbols(void)
**************************************************************************/
extern char *ExpandKadds(char *line, char *el)
{
- auto char dlm,
- *kp,
+ auto char *kp,
*sl = line,
*elp = el,
*symbol;
@@ -781,7 +780,6 @@ extern char *ExpandKadds(char *line, char *el)
strcpy(el, sl);
return(el);
}
- dlm = *kp;
strncpy(num,sl+1,kp-sl-1);
num[kp-sl-1] = '\0';
value = strtoul(num, (char **) 0, 16);
diff --git a/runtime/cfsysline.c b/runtime/cfsysline.c
index 5df8e64c..5ab73184 100644
--- a/runtime/cfsysline.c
+++ b/runtime/cfsysline.c
@@ -963,11 +963,11 @@ void dbgPrintCfSysLineHandlers(void)
dbgprintf("Sytem Line Configuration Commands:\n");
llCookieCmd = NULL;
- while((iRet = llGetNextElt(&llCmdList, &llCookieCmd, (void*)&pCmd)) == RS_RET_OK) {
+ while(llGetNextElt(&llCmdList, &llCookieCmd, (void*)&pCmd) == RS_RET_OK) {
llGetKey(llCookieCmd, (void*) &pKey); /* TODO: using the cookie is NOT clean! */
dbgprintf("\tCommand '%s':\n", pKey);
llCookieCmdHdlr = NULL;
- while((iRet = llGetNextElt(&pCmd->llCmdHdlrs, &llCookieCmdHdlr, (void*)&pCmdHdlr)) == RS_RET_OK) {
+ while(llGetNextElt(&pCmd->llCmdHdlrs, &llCookieCmdHdlr, (void*)&pCmdHdlr) == RS_RET_OK) {
dbgprintf("\t\ttype : %d\n", pCmdHdlr->eType);
dbgprintf("\t\tpData: 0x%lx\n", (unsigned long) pCmdHdlr->pData);
dbgprintf("\t\tHdlr : 0x%lx\n", (unsigned long) pCmdHdlr->cslCmdHdlr);
diff --git a/runtime/conf.c b/runtime/conf.c
index e2d3a889..bbd2147a 100644
--- a/runtime/conf.c
+++ b/runtime/conf.c
@@ -1084,7 +1084,7 @@ static rsRetVal cflineDoAction(uchar **p, action_t **ppAction)
DEFiRet;
modInfo_t *pMod;
omodStringRequest_t *pOMSR;
- action_t *pAction;
+ action_t *pAction = NULL;
void *pModData;
ASSERT(p != NULL);
diff --git a/runtime/ctok.c b/runtime/ctok.c
index 18ddaed2..99b0e095 100644
--- a/runtime/ctok.c
+++ b/runtime/ctok.c
@@ -1,4 +1,4 @@
-/* cfgtok.c - helper class to tokenize an input stream - which surprisingly
+/* ctok.c - helper class to tokenize an input stream - which surprisingly
* currently does not work with streams but with string. But that will
* probably change over time ;) This class was originally written to support
* the expression module but may evolve when (if) the expression module is
@@ -267,7 +267,7 @@ ctokGetVar(ctok_t *pThis, ctok_token_t *pToken)
{
DEFiRet;
uchar c;
- cstr_t *pstrVal;
+ cstr_t *pstrVal = NULL;
ISOBJ_TYPE_assert(pThis, ctok);
ASSERT(pToken != NULL);
diff --git a/runtime/debug.c b/runtime/debug.c
index 0ada909b..81b45d41 100644
--- a/runtime/debug.c
+++ b/runtime/debug.c
@@ -435,14 +435,13 @@ dbgMutLog_t *dbgMutLogFindHolder(pthread_mutex_t *pmut)
static inline void dbgMutexPreLockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncDB, int ln)
{
dbgMutLog_t *pHolder;
- dbgMutLog_t *pLog;
char pszBuf[128];
char pszHolderThrdName[64];
char *pszHolder;
pthread_mutex_lock(&mutMutLog);
pHolder = dbgMutLogFindHolder(pmut);
- pLog = dbgMutLogAddEntry(pmut, MUTOP_LOCKWAIT, pFuncDB, ln);
+ dbgMutLogAddEntry(pmut, MUTOP_LOCKWAIT, pFuncDB, ln);
if(pHolder == NULL)
pszHolder = "[NONE]";
@@ -483,14 +482,13 @@ static inline void dbgMutexLockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncDB,
static inline void dbgMutexPreTryLockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncDB, int ln)
{
dbgMutLog_t *pHolder;
- dbgMutLog_t *pLog;
char pszBuf[128];
char pszHolderThrdName[64];
char *pszHolder;
pthread_mutex_lock(&mutMutLog);
pHolder = dbgMutLogFindHolder(pmut);
- pLog = dbgMutLogAddEntry(pmut, MUTOP_TRYLOCK, pFuncDB, ln);
+ dbgMutLogAddEntry(pmut, MUTOP_TRYLOCK, pFuncDB, ln);
if(pHolder == NULL)
pszHolder = "[NONE]";
diff --git a/runtime/msg.c b/runtime/msg.c
index 10c5f82a..c450d6bd 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -1485,7 +1485,7 @@ rsRetVal MsgSetPROCID(msg_t *pMsg, char* pszPROCID)
CHKiRet(cstrConstruct(&pMsg->pCSPROCID));
}
/* if we reach this point, we have the object */
- iRet = rsCStrSetSzStr(pMsg->pCSPROCID, (uchar*) pszPROCID);
+ CHKiRet(rsCStrSetSzStr(pMsg->pCSPROCID, (uchar*) pszPROCID));
CHKiRet(cstrFinalize(pMsg->pCSPROCID));
finalize_it:
@@ -2881,7 +2881,6 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
if(pTpe->data.field.options.bCSV) {
/* we need to obtain a private copy, as we need to at least add the double quotes */
int iBufLen;
- int i;
uchar *pBStart;
uchar *pDst;
uchar *pSrc;
@@ -2896,7 +2895,6 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
RET_OUT_OF_MEMORY;
}
pSrc = pRes;
- i = 0;
*pDst++ = '"'; /* starting quote */
while(*pSrc) {
if(*pSrc == '"')
diff --git a/runtime/parser.c b/runtime/parser.c
index 810bf42b..fdda9546 100644
--- a/runtime/parser.c
+++ b/runtime/parser.c
@@ -272,7 +272,6 @@ rsRetVal parseMsg(msg_t *pMsg)
uchar *msg;
int pri;
int lenMsg;
- int iPriText;
if(pMsg->iLenRawMsg == 0)
ABORT_FINALIZE(RS_RET_EMPTY_MSG);
@@ -286,7 +285,6 @@ rsRetVal parseMsg(msg_t *pMsg)
lenMsg = pMsg->iLenRawMsg;
msg = pMsg->pszRawMsg;
pri = DEFUPRI;
- iPriText = 0;
if(pMsg->msgFlags & NO_PRI_IN_RAW) {
/* In this case, simply do so as if the pri would be right at top */
MsgSetAfterPRIOffs(pMsg, 0);
diff --git a/runtime/queue.c b/runtime/queue.c
index bedefb77..0c9d863f 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -685,7 +685,6 @@ qqueueHaveQIF(qqueue_t *pThis)
{
DEFiRet;
uchar pszQIFNam[MAXFNAME];
- size_t lenQIFNam;
struct stat stat_buf;
ISOBJ_TYPE_assert(pThis, qqueue);
@@ -694,8 +693,8 @@ qqueueHaveQIF(qqueue_t *pThis)
ABORT_FINALIZE(RS_RET_NO_FILEPREFIX);
/* Construct file name */
- lenQIFNam = snprintf((char*)pszQIFNam, sizeof(pszQIFNam) / sizeof(uchar), "%s/%s.qi",
- (char*) glbl.GetWorkDir(), (char*)pThis->pszFilePrefix);
+ snprintf((char*)pszQIFNam, sizeof(pszQIFNam) / sizeof(uchar), "%s/%s.qi",
+ (char*) glbl.GetWorkDir(), (char*)pThis->pszFilePrefix);
/* check if the file exists */
if(stat((char*) pszQIFNam, &stat_buf) == -1) {
diff --git a/runtime/wtp.c b/runtime/wtp.c
index fff37c2f..b4fd2e04 100644
--- a/runtime/wtp.c
+++ b/runtime/wtp.c
@@ -478,7 +478,7 @@ wtpWorker(void *arg) /* the arg is actually a wti object, even though we are in
do {
END_MTX_PROTECTED_OPERATIONS(&pThis->mut);
- iRet = wtiWorker(pWti); /* just to make sure: this is NOT protected by the mutex! */
+ wtiWorker(pWti); /* just to make sure: this is NOT protected by the mutex! */
BEGIN_MTX_PROTECTED_OPERATIONS(&pThis->mut, LOCK_MUTEX);
} while(pThis->iCurNumWrkThrd == 1 && pThis->bInactivityGuard == 1);
diff --git a/template.c b/template.c
index 68c57be1..a5331d57 100644
--- a/template.c
+++ b/template.c
@@ -82,9 +82,9 @@ rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar **ppBuf, size_t *
DEFiRet;
struct templateEntry *pTpe;
int iBuf;
- unsigned short bMustBeFreed;
+ unsigned short bMustBeFreed = 0;
uchar *pVal;
- size_t iLenVal;
+ size_t iLenVal = 0;
assert(pTpl != NULL);
assert(pMsg != NULL);
@@ -980,7 +980,6 @@ void tplDeleteAll(void)
{
struct template *pTpl, *pTplDel;
struct templateEntry *pTpe, *pTpeDel;
- rsRetVal iRetLocal;
BEGINfunc
pTpl = tplRoot;
@@ -1003,7 +1002,7 @@ void tplDeleteAll(void)
case FIELD:
/* check if we have a regexp and, if so, delete it */
if(pTpeDel->data.field.has_regex != 0) {
- if((iRetLocal = objUse(regexp, LM_REGEXP_FILENAME)) == RS_RET_OK) {
+ if(objUse(regexp, LM_REGEXP_FILENAME) == RS_RET_OK) {
regexp.regfree(&(pTpeDel->data.field.re));
}
}
@@ -1029,7 +1028,6 @@ void tplDeleteNew(void)
{
struct template *pTpl, *pTplDel;
struct templateEntry *pTpe, *pTpeDel;
- rsRetVal iRetLocal;
BEGINfunc
@@ -1058,7 +1056,7 @@ void tplDeleteNew(void)
case FIELD:
/* check if we have a regexp and, if so, delete it */
if(pTpeDel->data.field.has_regex != 0) {
- if((iRetLocal = objUse(regexp, LM_REGEXP_FILENAME)) == RS_RET_OK) {
+ if(objUse(regexp, LM_REGEXP_FILENAME) == RS_RET_OK) {
regexp.regfree(&(pTpeDel->data.field.re));
}
}
diff --git a/threads.c b/threads.c
index 13222694..051903de 100644
--- a/threads.c
+++ b/threads.c
@@ -151,7 +151,6 @@ rsRetVal thrdCreate(rsRetVal (*thrdMain)(thrdInfo_t*), rsRetVal(*afterRun)(thrdI
{
DEFiRet;
thrdInfo_t *pThis;
- int i;
assert(thrdMain != NULL);
@@ -159,7 +158,7 @@ rsRetVal thrdCreate(rsRetVal (*thrdMain)(thrdInfo_t*), rsRetVal(*afterRun)(thrdI
pThis->bIsActive = 1;
pThis->pUsrThrdMain = thrdMain;
pThis->pAfterRun = afterRun;
- i = pthread_create(&pThis->thrdID, NULL, thrdStarter, pThis);
+ pthread_create(&pThis->thrdID, NULL, thrdStarter, pThis);
CHKiRet(llAppend(&llThrds, NULL, pThis));
finalize_it:
diff --git a/tools/omfile.c b/tools/omfile.c
index a45d904b..e543ec9b 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -372,7 +372,6 @@ prepareFile(instanceData *pData, uchar *newFileName)
}
} else {
/* file does not exist, create it (and eventually parent directories */
- fd = -1;
if(pData->bCreateDirs) {
/* We first need to create parent dirs if they are missing.
* We do not report any errors here ourselfs but let the code
diff --git a/tools/omfwd.c b/tools/omfwd.c
index cbfc36a4..96b365a0 100644
--- a/tools/omfwd.c
+++ b/tools/omfwd.c
@@ -515,7 +515,6 @@ finalize_it:
BEGINparseSelectorAct
uchar *q;
int i;
- int bErr;
rsRetVal localRet;
struct addrinfo;
TCPFRAMINGMODE tcp_framing = TCP_FRAMING_OCTET_STUFFING;
@@ -638,7 +637,6 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
}
/* now skip to template */
- bErr = 0;
while(*p && *p != ';' && *p != '#' && !isspace((int) *p))
++p; /*JUST SKIP*/
diff --git a/tools/omusrmsg.c b/tools/omusrmsg.c
index e61751dc..768baca7 100644
--- a/tools/omusrmsg.c
+++ b/tools/omusrmsg.c
@@ -249,7 +249,6 @@ static rsRetVal wallmsg(uchar* pMsg, instanceData *pData)
}
}
close(ttyf);
- ttyf = -1;
}
}
diff --git a/tools/rsyslog.conf.5 b/tools/rsyslog.conf.5
index e8a4ab92..e17da974 100644
--- a/tools/rsyslog.conf.5
+++ b/tools/rsyslog.conf.5
@@ -200,11 +200,11 @@ to overwrite the preceding ones. Using this behavior you can exclude some
priorities from the pattern.
Rsyslogd has a syntax extension to the original BSD source, that makes its use
-more intuitively. You may precede every priority with an equation sign ('=') to
+more intuitively. You may precede every priority with an equals sign ('=') to
specify only this single priority and not any of the above. You may also (both
is valid, too) precede the priority with an exclamation mark ('!') to ignore
all that priorities, either exact this one or this and any higher priority. If
-you use both extensions than the exclamation mark must occur before the equation
+you use both extensions than the exclamation mark must occur before the equals
sign, just use it intuitively.
.SH ACTIONS
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 985957a3..fb1c6e0e 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -1195,7 +1195,6 @@ int parseLegacySyslogMsg(msg_t *pMsg, int flags)
{
uchar *p2parse;
int lenMsg;
- int bTAGCharDetected;
int i; /* general index for parsing */
uchar bufParseTAG[CONF_TAG_MAXSIZE];
uchar bufParseHOSTNAME[CONF_HOSTNAME_MAXSIZE];
@@ -1256,7 +1255,6 @@ int parseLegacySyslogMsg(msg_t *pMsg, int flags)
* rgerhards, 2009-06-23: and I now have extended this logic to every character
* that is not a valid hostname.
*/
- bTAGCharDetected = 0;
if(lenMsg > 0 && flags & PARSE_HOSTNAME) {
i = 0;
while(i < lenMsg && (isalnum(p2parse[i]) || p2parse[i] == '.' || p2parse[i] == '.'