X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fpostgresql.c;h=90e9f5db606ddcec80868e2225d8051f113221f4;hb=afca57287ae0c7b98e503be2a04270f06766c716;hp=9959690a1ad8553c1f40567a8dc14778f3052ac7;hpb=4cca3a1b70c8320c613bb249664a3a9f879ff8d5;p=collectd.git diff --git a/src/postgresql.c b/src/postgresql.c index 9959690a..90e9f5db 100644 --- a/src/postgresql.c +++ b/src/postgresql.c @@ -244,6 +244,7 @@ static c_psql_database_t *c_psql_database_new (const char *name) static void c_psql_database_delete (c_psql_database_t *db) { PQfinish (db->conn); + db->conn = NULL; sfree (db->queries); db->queries_num = 0; @@ -549,6 +550,12 @@ static int c_psql_init (void) int j; + /* this will happen during reinitialization */ + if (NULL != db->conn) { + c_psql_check_connection (db); + continue; + } + status = ssnprintf (buf, buf_len, "dbname = '%s'", db->database); if (0 < status) { buf += status;