diff options
author | Jason Parker <jparker@digium.com> | 2007-05-11 21:15:30 +0000 |
---|---|---|
committer | Jason Parker <jparker@digium.com> | 2007-05-11 21:15:30 +0000 |
commit | cdfa29e2b1a4dd789c6f35b4d90814a19edadc66 (patch) | |
tree | e761e22618154cf1fd5f732d17cd9c47dab3806e /main | |
parent | 8b5634e4b47f763c788190c94e689242c03a663c (diff) |
Better fallback method for autosystemname.
Issue 9713, patch by Juggie with minor mods by me.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@64012 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r-- | main/asterisk.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/main/asterisk.c b/main/asterisk.c index c44e2cbd6..a8dd93d75 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -2529,8 +2529,10 @@ static void ast_readconfig(void) 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")) { |