[asterisk-commits] twilson: branch twilson/calendaring r167062 - /team/twilson/calendaring/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Dec 31 17:19:19 CST 2008


Author: twilson
Date: Wed Dec 31 17:19:18 2008
New Revision: 167062

URL: http://svn.digium.com/view/asterisk?view=rev&rev=167062
Log:
Test for unchanged config file

Modified:
    team/twilson/calendaring/main/calendar.c

Modified: team/twilson/calendaring/main/calendar.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/main/calendar.c?view=diff&rev=167062&r1=167061&r2=167062
==============================================================================
--- team/twilson/calendaring/main/calendar.c (original)
+++ team/twilson/calendaring/main/calendar.c Wed Dec 31 17:19:18 2008
@@ -709,17 +709,25 @@
 static int load_config(void *data)
 {
 	const char *cat = NULL;
-	struct ast_flags config_flags = { 0 };
+	struct ast_flags config_flags = { CONFIG_FLAG_FILEUNCHANGED };
+	struct ast_config *tmpcfg;
 	const char *val;
+
+	if (!(tmpcfg = ast_config_load2("calendar.conf", "calendar", config_flags)) ||
+		tmpcfg == CONFIG_STATUS_FILEINVALID) {
+		ast_log(LOG_ERROR, "Unable to load config calendar.conf\n");
+		return -1;
+	}
+
+	if (tmpcfg == CONFIG_STATUS_FILEUNCHANGED) {
+		return 0;
+	}
 
 	if (calendar_config) {
 		ast_config_destroy(calendar_config);
 	}
 
-	if (!(calendar_config = ast_config_load2("calendar.conf", "calendar", config_flags))) {
-		ast_log(LOG_ERROR, "Unable to load config calendar.conf\n");
-		return -1;
-	}
+	calendar_config = tmpcfg;
 
 	while ((cat = ast_category_browse(calendar_config, cat))) {
 		if (!strcasecmp(cat, "general")) {




More information about the asterisk-commits mailing list