[asterisk-commits] seanbright: trunk r373203 - /trunk/res/res_curl.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 20 06:05:43 CDT 2012


Author: seanbright
Date: Thu Sep 20 06:05:40 2012
New Revision: 373203

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=373203
Log:
When trying to unload res_curl.so, warn about all dependent modules.

Before this, attempting to unload res_curl.so would warn you about the first
module it found that was dependent.  We now warn about all of the loaded modules
instead.

Modified:
    trunk/res/res_curl.c

Modified: trunk/res/res_curl.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_curl.c?view=diff&rev=373203&r1=373202&r2=373203
==============================================================================
--- trunk/res/res_curl.c (original)
+++ trunk/res/res_curl.c Thu Sep 20 06:05:40 2012
@@ -39,20 +39,26 @@
 
 #include "asterisk/module.h"
 
+static const char *dependents[] = {
+	"func_curl.so",
+	"res_config_curl.so",
+};
+
 static int unload_module(void)
 {
 	int res = 0;
+	size_t i;
 
 	/* If the dependent modules are still in memory, forbid unload */
-	if (ast_module_check("func_curl.so")) {
-		ast_log(LOG_ERROR, "func_curl.so (dependent module) is still loaded.  Cannot unload res_curl.so\n");
-		return -1;
+	for (i = 0; i < ARRAY_LEN(dependents); i++) {
+		if (ast_module_check(dependents[i])) {
+			ast_log(LOG_ERROR, "%s (dependent module) is still loaded.  Cannot unload res_curl.so\n", dependents[i]);
+			res = -1;
+		}
 	}
 
-	if (ast_module_check("res_config_curl.so")) {
-		ast_log(LOG_ERROR, "res_config_curl.so (dependent module) is still loaded.  Cannot unload res_curl.so\n");
+	if (res)
 		return -1;
-	}
 
 	curl_global_cleanup();
 
@@ -64,7 +70,7 @@
 	int res = 0;
 
 	if (curl_global_init(CURL_GLOBAL_ALL)) {
-		ast_log(LOG_ERROR, "Unable to initialize the CURL library. Cannot load res_curl\n");
+		ast_log(LOG_ERROR, "Unable to initialize the cURL library. Cannot load res_curl.so\n");
 		return AST_MODULE_LOAD_DECLINE;
 	}
 




More information about the asterisk-commits mailing list