From 7a7f048d9750eeed7eb248f437fe88e89ee4f7ae Mon Sep 17 00:00:00 2001
From: Paul Belanger <paul.belanger@polybeacon.com>
Date: Tue, 13 Sep 2011 21:52:59 +0000
Subject: [PATCH] Additional updates for parsing dnsmgr.conf

Review: https://reviewboard.asterisk.org/r/1432/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@335719 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 main/dnsmgr.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/main/dnsmgr.c b/main/dnsmgr.c
index a62c37185c..bd3ab78e35 100644
--- a/main/dnsmgr.c
+++ b/main/dnsmgr.c
@@ -386,11 +386,9 @@ static int do_reload(int loading)
 	struct ast_flags config_flags = { loading ? 0 : CONFIG_FLAG_FILEUNCHANGED };
 	int interval;
 	int was_enabled;
-	int res = 0;
 
-	config = ast_config_load2("dnsmgr.conf", "dnsmgr", config_flags);
-	if (config == CONFIG_STATUS_FILEMISSING || config == CONFIG_STATUS_FILEUNCHANGED || config == CONFIG_STATUS_FILEINVALID) {
-		return res;
+	if ((config = ast_config_load2("dnsmgr.conf", "dnsmgr", config_flags)) == CONFIG_STATUS_FILEUNCHANGED) {
+		return 0;
 	}
 
 	/* ensure that no refresh cycles run while the reload is in progress */
@@ -401,6 +399,11 @@ static int do_reload(int loading)
 	was_enabled = enabled;
 	enabled = 0;
 
+	if (config == CONFIG_STATUS_FILEMISSING || config == CONFIG_STATUS_FILEINVALID) {
+		ast_mutex_unlock(&refresh_lock);
+		return 0;
+	}
+
 	AST_SCHED_DEL(sched, refresh_sched);
 
 	for (v = ast_variable_browse(config, "general"); v; v = v->next) {
@@ -444,5 +447,5 @@ static int do_reload(int loading)
 	ast_mutex_unlock(&refresh_lock);
 	manager_event(EVENT_FLAG_SYSTEM, "Reload", "Module: DNSmgr\r\nStatus: %s\r/nMessage: DNSmgr reload Requested\r\n", enabled ? "Enabled" : "Disabled");
 
-	return res;
+	return 0;
 }
-- 
GitLab