[asterisk-commits] file: trunk r43162 - /trunk/res/res_config_pgsql.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Sep 18 08:15:33 MST 2006


Author: file
Date: Mon Sep 18 10:15:33 2006
New Revision: 43162

URL: http://svn.digium.com/view/asterisk?rev=43162&view=rev
Log:
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)

Modified:
    trunk/res/res_config_pgsql.c

Modified: trunk/res/res_config_pgsql.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_config_pgsql.c?rev=43162&r1=43161&r2=43162&view=diff
==============================================================================
--- trunk/res/res_config_pgsql.c (original)
+++ trunk/res/res_config_pgsql.c Mon Sep 18 10:15:33 2006
@@ -729,7 +729,7 @@
 		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;



More information about the asterisk-commits mailing list