[asterisk-commits] trunk r28897 - /trunk/cdr/cdr_pgsql.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri May 19 17:57:05 MST 2006


Author: russell
Date: Fri May 19 19:57:04 2006
New Revision: 28897

URL: http://svn.digium.com/view/asterisk?rev=28897&view=rev
Log:
if a hostname is not specified, connect over a unix socket instead of
connecting to localhost (issue #7145, Mithraen)

Modified:
    trunk/cdr/cdr_pgsql.c

Modified: trunk/cdr/cdr_pgsql.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_pgsql.c?rev=28897&r1=28896&r2=28897&view=diff
==============================================================================
--- trunk/cdr/cdr_pgsql.c (original)
+++ trunk/cdr/cdr_pgsql.c Fri May 19 19:57:04 2006
@@ -222,8 +222,8 @@
 
 	tmp = ast_variable_retrieve(cfg,"global","hostname");
 	if (tmp == NULL) {
-		ast_log(LOG_WARNING,"PostgreSQL server hostname not specified.  Assuming localhost\n");
-		tmp = "localhost";
+		ast_log(LOG_WARNING,"PostgreSQL server hostname not specified.  Assuming unix socket connection\n");
+		tmp = "";	/* connect via UNIX-socket by default */
 	}
 	pghostname = strdup(tmp);
 	if (pghostname == NULL) {
@@ -287,10 +287,11 @@
 	}
 
 	if (option_debug) {
-		ast_log(LOG_DEBUG, "cdr_pgsql: got hostname of %s\n", pghostname);
+	    	if (ast_strlen_zero(pghostname))
+			ast_log(LOG_DEBUG, "cdr_pgsql: using default unix socket\n");
+		else
+			ast_log(LOG_DEBUG, "cdr_pgsql: got hostname of %s\n", pghostname);
 		ast_log(LOG_DEBUG, "cdr_pgsql: got port of %s\n", pgdbport);
-		if (pgdbsock)
-			ast_log(LOG_DEBUG, "cdr_pgsql: got sock file of %s\n", pgdbsock);
 		ast_log(LOG_DEBUG, "cdr_pgsql: got user of %s\n", pgdbuser);
 		ast_log(LOG_DEBUG, "cdr_pgsql: got dbname of %s\n", pgdbname);
 		ast_log(LOG_DEBUG, "cdr_pgsql: got password of %s\n", pgpassword);



More information about the asterisk-commits mailing list