summaryrefslogtreecommitdiff
path: root/res/res_curl.c
diff options
context:
space:
mode:
authorSean Bright <sean@malleable.com>2012-09-20 11:05:40 +0000
committerSean Bright <sean@malleable.com>2012-09-20 11:05:40 +0000
commit7b823e9f8e6e92e44da65d598e3e5a6a1ef47466 (patch)
treed11a355158432d44929cc4cd99cad1c6e566ebaa /res/res_curl.c
parented442248e56c93b4588006d29626e44e0d4dd74a (diff)
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. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373203 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_curl.c')
-rw-r--r--res/res_curl.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/res/res_curl.c b/res/res_curl.c
index 08e6aa139..663ecd17d 100644
--- a/res/res_curl.c
+++ b/res/res_curl.c
@@ -39,20 +39,26 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#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 @@ static int load_module(void)
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;
}