kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit a35a5182a72b2dfd8c1c07e0eb3e0392dfe88892
parent 6cabe00740910c212a7bb4e996630b6717c0ef9c
Author: Joris Vink <joris@coders.se>
Date:   Mon, 14 Apr 2014 08:45:31 +0200

Check connection string right before we connect

Diffstat:
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 @@ -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);