From a35a5182a72b2dfd8c1c07e0eb3e0392dfe88892 Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Mon, 14 Apr 2014 08:45:31 +0200 Subject: [PATCH] Check connection string right before we connect --- contrib/postgres/kore_pgsql.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/postgres/kore_pgsql.c b/contrib/postgres/kore_pgsql.c index c661108..778475b 100644 --- a/contrib/postgres/kore_pgsql.c +++ b/contrib/postgres/kore_pgsql.c @@ -56,9 +56,6 @@ char *pgsql_conn_string = NULL; void kore_pgsql_init(void) { - if (pgsql_conn_string == NULL) - fatal("No pgsql connection string set"); - pgsql_conn_count = 0; TAILQ_INIT(&pgsql_conn_free); } @@ -247,6 +244,9 @@ pgsql_conn_create(struct http_request *req, int idx) { struct pgsql_conn *conn; + if (pgsql_conn_string == NULL) + fatal("pgsql_conn_create: no connection string"); + pgsql_conn_count++; conn = kore_malloc(sizeof(*conn)); kore_debug("pgsql_conn_create(): %p", conn);