[svn-commits] file: trunk r366 - /trunk/res_config_mysql.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Apr 16 06:16:42 MST 2007


Author: file
Date: Mon Apr 16 08:16:41 2007
New Revision: 366

URL: http://svn.digium.com/view/asterisk-addons?view=rev&rev=366
Log:
Clean up res_config_mysql even more! (issue #9541 reported by sergee)

Modified:
    trunk/res_config_mysql.c

Modified: trunk/res_config_mysql.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/res_config_mysql.c?view=diff&rev=366&r1=365&r2=366
==============================================================================
--- trunk/res_config_mysql.c (original)
+++ trunk/res_config_mysql.c Mon Apr 16 08:16:41 2007
@@ -164,6 +164,8 @@
 
 		while ((row = mysql_fetch_row(result))) {
 			for (i = 0; i < numFields; i++) {
+				if (ast_strlen_zero(row[i]))
+					continue;
 				for (stringp = ast_strdupa(row[i]), chunk = strsep(&stringp, ";"); chunk; chunk = strsep(&stringp, ";")) {
 					if (chunk && !ast_strlen_zero(ast_strip(chunk))) {
 						if (prev) {
@@ -792,14 +794,13 @@
 	} else
 		conn->port = atoi(s);
 
-	if (ast_strlen_zero(conn->host)) {
-		if (!(s = ast_variable_retrieve(config, "general", "dbsock"))) {
+	if (!(s = ast_variable_retrieve(config, "general", "dbsock"))) {
+		if (ast_strlen_zero(conn->host)) {
 			ast_log(LOG_WARNING, "MySQL RealTime: No database socket found, using '/tmp/mysql.sock' as default.\n");
-			s = "/tmp/mysql.sock";
+			ast_copy_string(conn->sock, "/tmp/mysql.sock", sizeof(conn->sock));
 		}
+	} else
 		ast_copy_string(conn->sock, s, sizeof(conn->sock));
-	} else
-		ast_copy_string(conn->sock, "", sizeof(conn->sock));
 
 	if (!ast_strlen_zero(conn->host)) {
 		ast_log(LOG_DEBUG, "MySQL RealTime host: %s\n", conn->host);



More information about the svn-commits mailing list