[asterisk-commits] qwell: trunk r64012 - in /trunk: Makefile main/asterisk.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri May 11 14:15:30 MST 2007


Author: qwell
Date: Fri May 11 16:15:30 2007
New Revision: 64012

URL: http://svn.digium.com/view/asterisk?view=rev&rev=64012
Log:
Better fallback method for autosystemname.

Issue 9713, patch by Juggie with minor mods by me.

Modified:
    trunk/Makefile
    trunk/main/asterisk.c

Modified: trunk/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/Makefile?view=diff&rev=64012&r1=64011&r2=64012
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Fri May 11 16:15:30 2007
@@ -545,7 +545,7 @@
 		echo ";[options]" ; \
 		echo ";internal_timing = yes" ; \
 		echo ";systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues" ; \
-		echo ";autosystemname = yes ; automatically set systemname to hostname - uses 'localhost' on failure" ; \
+		echo ";autosystemname = yes ; automatically set systemname to hostname - uses 'localhost' on failure, or systemname if set" ; \
 		echo "; Changing the following lines may compromise your security." ; \
 		echo ";[files]" ; \
 		echo ";astctlpermissions = 0660" ; \

Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?view=diff&rev=64012&r1=64011&r2=64012
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Fri May 11 16:15:30 2007
@@ -2529,8 +2529,10 @@
 				if (!gethostname(hostname, sizeof(hostname) - 1))
 					ast_copy_string(ast_config_AST_SYSTEM_NAME, hostname, sizeof(ast_config_AST_SYSTEM_NAME));
 				else {
-					ast_log(LOG_ERROR, "Cannot obtain hostname for this system.  Using 'localhost' instead.\n");
-					ast_copy_string(ast_config_AST_SYSTEM_NAME, "localhost", sizeof(ast_config_AST_SYSTEM_NAME));
+					if (!ast_strlen_zero(ast_config_AST_SYSTEM_NAME)){
+						ast_copy_string(ast_config_AST_SYSTEM_NAME, "localhost", sizeof(ast_config_AST_SYSTEM_NAME));
+					}
+					ast_log(LOG_ERROR, "Cannot obtain hostname for this system.  Using '%s' instead.\n", ast_config_AST_SYSTEM_NAME);
 				}
 			}
 		} else if (!strcasecmp(v->name, "languageprefix")) {



More information about the asterisk-commits mailing list