aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_config_pgsql.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-18 15:15:33 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-18 15:15:33 +0000
commitad75968657c3fd89983fa998050f01244b1622a6 (patch)
tree47103696d2c0fcf89d64c640a0bf6735acc27abc /res/res_config_pgsql.c
parent601bcf0ac3b6c6858ad3e4059b75a92362f020c3 (diff)
Use a better check to ensure database connection is up (pointer to connection must exist, and connection must report status being ok) (issue #7955 reported by sorg)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43162 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_config_pgsql.c')
-rw-r--r--res/res_config_pgsql.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index d3d11446a..4665823f3 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -729,7 +729,7 @@ static int pgsql_reconnect(const char *database)
free(connInfo);
connInfo = NULL;
ast_log(LOG_DEBUG, "pgsqlConn=%p\n", pgsqlConn);
- if (pgsqlConn) {
+ if (pgsqlConn && PQstatus(pgsqlConn) == CONNECTION_OK) {
ast_log(LOG_DEBUG, "Postgresql RealTime: Successfully connected to database.\n");
connect_time = time(NULL);
return 1;