From 668651378314023194734a70bd4b4d641797e824 Mon Sep 17 00:00:00 2001 From: Pierre Chifflier Date: Tue, 6 Jan 2009 23:31:13 +0100 Subject: PostgreSQL: allow local connections This patch allows to connect to the server using the local (unix) socket, thus not using a network socket and SSL encryption. Local connection is used if host parameter is omitted or empty. Signed-off-by: Pierre Chifflier --- output/pgsql/ulogd_output_PGSQL.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/output/pgsql/ulogd_output_PGSQL.c b/output/pgsql/ulogd_output_PGSQL.c index afab2cc..9529b1c 100644 --- a/output/pgsql/ulogd_output_PGSQL.c +++ b/output/pgsql/ulogd_output_PGSQL.c @@ -237,8 +237,9 @@ static int open_db_pgsql(struct ulogd_pluginstance *upi) connstr = (char *) malloc(len); if (!connstr) return -ENOMEM; + connstr[0] = '\0'; - if (server) { + if (server && strlen(server) > 0) { strcpy(connstr, " host="); strcat(connstr, server); } -- cgit v1.2.3