diff options
author | Pierre Chifflier <chifflier@inl.fr> | 2009-01-06 23:31:13 +0100 |
---|---|---|
committer | Eric Leblond <eric@inl.fr> | 2009-01-07 00:15:41 +0100 |
commit | 668651378314023194734a70bd4b4d641797e824 (patch) | |
tree | 3d524ae1014d5915823796e25d64483a2432d513 | |
parent | fef9e7c57b003d934ec31acfefe451c5dd45e760 (diff) |
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 <chifflier@inl.fr>
-rw-r--r-- | output/pgsql/ulogd_output_PGSQL.c | 3 |
1 files changed, 2 insertions, 1 deletions
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); } |