summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-12-03 11:35:09 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-12-03 11:35:09 +0000
commit315145d0434ec3a028aed2d6de479c42886bd0f1 (patch)
treedac4446a4faf3140b0ef6c3c47844696979739e7 /plugins
parent1919403329dbfb567deabad3369a42b6509c3fa5 (diff)
downloadrsyslog-315145d0434ec3a028aed2d6de479c42886bd0f1.tar.gz
rsyslog-315145d0434ec3a028aed2d6de479c42886bd0f1.tar.xz
rsyslog-315145d0434ec3a028aed2d6de479c42886bd0f1.zip
some code cleanup
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ommysql/Makefile.am1
-rw-r--r--plugins/ommysql/ommysql.c1
-rw-r--r--plugins/ompgsql/Makefile.am1
-rw-r--r--plugins/ompgsql/ompgsql.c33
4 files changed, 11 insertions, 25 deletions
diff --git a/plugins/ommysql/Makefile.am b/plugins/ommysql/Makefile.am
index 7a8909ce..6397de5b 100644
--- a/plugins/ommysql/Makefile.am
+++ b/plugins/ommysql/Makefile.am
@@ -1,4 +1,3 @@
-pkglibdir = $(libdir)/rsyslog
pkglib_LTLIBRARIES = ommysql.la
ommysql_la_SOURCES = ommysql.c ommysql.h ../../module-template.h
diff --git a/plugins/ommysql/ommysql.c b/plugins/ommysql/ommysql.c
index 33651a79..bb3441af 100644
--- a/plugins/ommysql/ommysql.c
+++ b/plugins/ommysql/ommysql.c
@@ -196,7 +196,6 @@ rsRetVal writeMySQL(uchar *psz, instanceData *pData)
}
finalize_it:
-dbgprintf("writeMySQL result: %d\n", iRet);
if(iRet == RS_RET_OK) {
pData->uLastMySQLErrno = 0; /* reset error for error supression */
}
diff --git a/plugins/ompgsql/Makefile.am b/plugins/ompgsql/Makefile.am
index 1284662f..5206b36d 100644
--- a/plugins/ompgsql/Makefile.am
+++ b/plugins/ompgsql/Makefile.am
@@ -1,4 +1,3 @@
-pkglibdir = $(libdir)/rsyslog
pkglib_LTLIBRARIES = ompgsql.la
ompgsql_la_SOURCES = ompgsql.c ompgsql.h ../../module-template.h
diff --git a/plugins/ompgsql/ompgsql.c b/plugins/ompgsql/ompgsql.c
index 237f46ee..35b0b598 100644
--- a/plugins/ompgsql/ompgsql.c
+++ b/plugins/ompgsql/ompgsql.c
@@ -47,7 +47,7 @@
DEF_OMOD_STATIC_DATA
typedef struct _instanceData {
- PGconn *f_hpgsql; /* handle to PgSQL */
+ PGconn *f_hpgsql; /* handle to PgSQL */
char f_dbsrv[MAXHOSTNAMELEN+1]; /* IP or hostname of DB server*/
char f_dbname[_DB_MAXDBLEN+1]; /* DB name */
char f_dbuid[_DB_MAXUNAMELEN+1]; /* DB user */
@@ -109,7 +109,7 @@ ENDgetWriteFDForSelect
/* log a database error with descriptive message.
- * We check if we have a valid MySQL handle. If not, we simply
+ * We check if we have a valid handle. If not, we simply
* report an error, but can not be specific. RGerhards, 2007-01-30
*/
static void reportDBError(instanceData *pData, int bSilent)
@@ -118,7 +118,6 @@ static void reportDBError(instanceData *pData, int bSilent)
ConnStatusType ePgSQLStatus;
assert(pData != NULL);
- dbgprintf("bSilent was %i\n", bSilent);
bSilent=0;
/* output log message */
@@ -151,23 +150,15 @@ static rsRetVal initPgSQL(instanceData *pData, int bSilent)
assert(pData != NULL);
assert(pData->f_hpgsql == NULL);
- dbgprintf("host=%s dbname=%s uid=%s pswd=%s\n",pData->f_dbsrv,pData->f_dbname,pData->f_dbuid,pData->f_dbpwd);
+ dbgprintf("host=%s dbname=%s uid=%s\n",pData->f_dbsrv,pData->f_dbname,pData->f_dbuid);
- /*
- pData->f_hmysql = mysql_init(NULL);
- if(pData->f_hmysql == NULL) {
- logerror("can not initialize MySQL handle");
+ /* Connect to database */
+ if((pData->f_hpgsql=PQsetdbLogin(pData->f_dbsrv, NULL, NULL, NULL,
+ pData->f_dbname, pData->f_dbuid, pData->f_dbpwd)) == NULL) {
+ reportDBError(pData, bSilent);
+ closePgSQL(pData); /* ignore any error we may get */
iRet = RS_RET_SUSPENDED;
-
- } else { / * we could get the handle, now on with work... */
- /* Connect to database */
- if((pData->f_hpgsql=PQsetdbLogin(pData->f_dbsrv, NULL, NULL, NULL,
- pData->f_dbname, pData->f_dbuid, pData->f_dbpwd)) == NULL) {
- reportDBError(pData, bSilent);
- closePgSQL(pData); /* ignore any error we may get */
- iRet = RS_RET_SUSPENDED;
- }
- /*}*/
+ }
return iRet;
}
@@ -187,12 +178,12 @@ rsRetVal writePgSQL(uchar *psz, instanceData *pData)
/* try insert */
PQexec(pData->f_hpgsql, (char*)psz);
- if(PQstatus(pData->f_hpgsql)!=CONNECTION_OK) {
+ if(PQstatus(pData->f_hpgsql) != CONNECTION_OK) {
/* error occured, try to re-init connection and retry */
closePgSQL(pData); /* close the current handle */
CHKiRet(initPgSQL(pData, 0)); /* try to re-open */
PQexec(pData->f_hpgsql, (char*)psz);
- if(PQstatus(pData->f_hpgsql)!=CONNECTION_OK) { /* re-try insert */
+ if(PQstatus(pData->f_hpgsql) != CONNECTION_OK) { /* re-try insert */
/* we failed, giving up for now */
reportDBError(pData, 0);
closePgSQL(pData); /* free ressources */
@@ -236,13 +227,11 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
* rgerhards, 2007-10-15
*/
- dbgprintf("%p:%s\n",p,p);
if(!strncmp((char*) p, ":ompgsql:", sizeof(":ompgsql:") - 1)) {
p += strlen(":ompgsql:"); /* eat indicator sequence */
} else {
ABORT_FINALIZE(RS_RET_CONFLINE_UNPROCESSED);
}
- dbgprintf("%p:%s\n",p,p);
/* ok, if we reach this point, we have something for us */
if((iRet = createInstance(&pData)) != RS_RET_OK)