summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-02-12 07:40:34 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-02-12 07:40:34 +0000
commite1ebc4be355a1f3b8fe3c18fa3f2724c69927f4c (patch)
tree2396e397ec63d3c921675886df43570f79456492 /plugins
parentf4e7c64f91a65baa9d7872da15e07dec5cfd1278 (diff)
downloadrsyslog-e1ebc4be355a1f3b8fe3c18fa3f2724c69927f4c.tar.gz
rsyslog-e1ebc4be355a1f3b8fe3c18fa3f2724c69927f4c.tar.xz
rsyslog-e1ebc4be355a1f3b8fe3c18fa3f2724c69927f4c.zip
done a bit more cleanup on the "rsyslog way of doing things"
Diffstat (limited to 'plugins')
-rw-r--r--plugins/omsnmp/omsnmp.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/plugins/omsnmp/omsnmp.c b/plugins/omsnmp/omsnmp.c
index f7777523..72a40d1c 100644
--- a/plugins/omsnmp/omsnmp.c
+++ b/plugins/omsnmp/omsnmp.c
@@ -142,13 +142,12 @@ static rsRetVal omsnmp_exitSession(instanceData *pData)
static rsRetVal omsnmp_initSession(instanceData *pData)
{
DEFiRet;
+ netsnmp_session session;
/* should not happen, but if session is not cleared yet - we do it now! */
if (pData->snmpsession != NULL)
omsnmp_exitSession(pData);
- netsnmp_session session;
-
dbgprintf( "omsnmp_initSession: ENTER - Target = '%s' on Port = '%d'\n", pData->szTarget, pData->iPort);
putenv(strdup("POSIXLY_CORRECT=1"));
@@ -167,17 +166,11 @@ static rsRetVal omsnmp_initSession(instanceData *pData)
}
pData->snmpsession = snmp_open(&session);
- if (pData->snmpsession == NULL)
- {
+ if (pData->snmpsession == NULL) {
logerrorVar("omsnmp_initSession: snmp_open to host '%s' on Port '%d' failed\n", pData->szTarget, pData->iPort);
- /* Stay suspended */
+ /* Stay suspended */
iRet = RS_RET_SUSPENDED;
}
- else
- {
- /* Report success */
- iRet = RS_RET_OK;
- }
RETiRet;
}
@@ -196,16 +189,12 @@ static rsRetVal omsnmp_sendsnmp(instanceData *pData, uchar *psz)
const char *strErr = NULL;
/* Init SNMP Session if necessary */
- if (pData->snmpsession == NULL)
- {
- iRet = omsnmp_initSession(pData);
- if (iRet != RS_RET_OK) {
- ABORT_FINALIZE(iRet); /* This will most likely return RS_RET_SUSPENDED */
- }
+ if (pData->snmpsession == NULL) {
+ CHKiRet(omsnmp_initSession(pData));
}
/* String should not be NULL */
- assert(psz != NULL);
+ ASSERT(psz != NULL);
dbgprintf( "omsnmp_sendsnmp: ENTER - Syslogmessage = '%s'\n", (char*)psz);
/* If SNMP Version1 is configured !*/
@@ -305,6 +294,7 @@ finalize_it:
RETiRet;
}
+
BEGINtryResume
CODESTARTtryResume
iRet = omsnmp_initSession(pData);