From 4b7a458de6f5932c16f6b3eda8337d631aa4924c Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Sun, 13 Apr 2014 23:43:54 +0200 Subject: [PATCH] If kore_pgsql_query() fails, relay this properly --- includes/contrib/postgres/kore_pgsql.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/contrib/postgres/kore_pgsql.h b/includes/contrib/postgres/kore_pgsql.h index 06fdb16..849a9d6 100644 --- a/includes/contrib/postgres/kore_pgsql.h +++ b/includes/contrib/postgres/kore_pgsql.h @@ -46,7 +46,13 @@ char *kore_pgsql_getvalue(struct kore_pgsql *, int, int); #define KORE_PGSQL(r, q, i, s) \ do { \ if (r->pgsql[i] == NULL) \ - kore_pgsql_query(r, q, i); \ + if (!kore_pgsql_query(r, q, i)) { \ + if (r->pgsql[i] == NULL) \ + return (KORE_RESULT_RETRY); \ + s; \ + r->pgsql[i]->state = \ + KORE_PGSQL_STATE_COMPLETE; \ + } \ if (r->pgsql[i] == NULL) \ return (KORE_RESULT_RETRY); \ switch (r->pgsql[i]->state) { \