[svn-commits] twilson: trunk r242812 - /trunk/res/res_calendar.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jan 25 12:01:11 CST 2010


Author: twilson
Date: Mon Jan 25 12:01:08 2010
New Revision: 242812

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=242812
Log:
Fix INTERNAL_OBJ error on stop when calendars.conf missing

Initialize the calendars container before calling load_config and return FAILURE
on allocation failure. Also, use the AST_MODULE_LOAD_* values for return values.
Thanks to rmudgett for pointing out the error and the need to use the defined
values for return

Modified:
    trunk/res/res_calendar.c

Modified: trunk/res/res_calendar.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_calendar.c?view=diff&rev=242812&r1=242811&r2=242812
==============================================================================
--- trunk/res/res_calendar.c (original)
+++ trunk/res/res_calendar.c Mon Jan 25 12:01:08 2010
@@ -1647,14 +1647,14 @@
 
 static int load_module(void)
 {
+	if (!(calendars = ao2_container_alloc(CALENDAR_BUCKETS, calendar_hash_fn, calendar_cmp_fn))) {
+		ast_log(LOG_ERROR, "Unable to allocate calendars container!\n");
+		return AST_MODULE_LOAD_FAILURE;
+	}
+
 	if (load_config(NULL)) {
 		/* We don't have calendar support enabled */
-		return 0;
-	}
-
-	if (!(calendars = ao2_container_alloc(CALENDAR_BUCKETS, calendar_hash_fn, calendar_cmp_fn))) {
-		ast_log(LOG_ERROR, "Unable to allocate calendars container!\n");
-		return -1;
+		return AST_MODULE_LOAD_DECLINE;
 	}
 
 	ast_mutex_init(&refreshlock);
@@ -1663,7 +1663,7 @@
 
 	if (!(sched = sched_context_create())) {
 		ast_log(LOG_ERROR, "Unable to create sched context\n");
-		return -1;
+		return AST_MODULE_LOAD_FAILURE;
 	}
 
 	if (ast_pthread_create_background(&refresh_thread, NULL, do_refresh, NULL) < 0) {
@@ -1682,7 +1682,7 @@
 	/* Since other modules depend on this, disable unloading */
 	ast_module_ref(ast_module_info->self);
 
-	return 0;
+	return AST_MODULE_LOAD_SUCCESS;
 }
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Asterisk Calendar integration",
 		.load = load_module,




More information about the svn-commits mailing list