Patchwork [2/2] Connection parameters other than connstring are ignored

login
register
mail settings
Submitter Bob Hockney
Date April 19, 2014, 6:43 p.m.
Message ID <201404221918.s3MJI0Hl022667@gateway.ford-prefect.net>
Download mbox | patch
Permalink /patch/341449/
State Deferred
Delegated to: Eric Leblond
Headers show

Comments

Bob Hockney - April 19, 2014, 6:43 p.m.
Connection parameters other than connstring are ignored,
 forcing its use.  u.string in config_keyset in conffile.h is a character
 array, not a pointer, and is initialized as a zero length string, not a null
 pointer, so the pointer assignment to connstr will always be a valid pointer,
 not NULL, so (! connstr) will always be false.

Signed-off-by: Bob Hockney <zeus@ix.netcom.com>
---
 output/pgsql/ulogd_output_PGSQL.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/output/pgsql/ulogd_output_PGSQL.c b/output/pgsql/ulogd_output_PGSQL.c
index fda289e..ac87a64 100644
--- a/output/pgsql/ulogd_output_PGSQL.c
+++ b/output/pgsql/ulogd_output_PGSQL.c
@@ -236,7 +236,7 @@  static int open_db_pgsql(struct ulogd_pluginstance *upi)
 	char *schema = NULL;
 	char pgbuf[128];
 
-	if (!connstr) {
+	if (! strlen(connstr)) {
 		char *server = host_ce(upi->config_kset).u.string;
 		unsigned int port = port_ce(upi->config_kset).u.value;
 		char *user = user_ce(upi->config_kset).u.string;