Merged revisions 275143 via svnmerge from
authorMatthew Nicholson <mnicholson@digium.com>
Fri, 9 Jul 2010 17:50:45 +0000 (17:50 +0000)
committerMatthew Nicholson <mnicholson@digium.com>
Fri, 9 Jul 2010 17:50:45 +0000 (17:50 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r275143 | mnicholson | 2010-07-09 12:50:05 -0500 (Fri, 09 Jul 2010) | 2 lines

  don't unload modules that returned AST_MODULE_LOAD_DECLINE when they were loaded
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275144 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/loader.c

index f44cef9..69a5a8c 100644 (file)
@@ -467,7 +467,7 @@ void ast_module_shutdown(void)
                                continue;
                        }
                        AST_LIST_REMOVE_CURRENT(entry);
-                       if (mod->info->unload) {
+                       if (mod->flags.running && !mod->flags.declined && mod->info->unload) {
                                mod->info->unload();
                        }
                        AST_LIST_HEAD_DESTROY(&mod->users);
@@ -494,7 +494,7 @@ int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode f
                return -1;
        }
 
-       if (!(mod->flags.running || mod->flags.declined))
+       if (!mod->flags.running || mod->flags.declined)
                error = 1;
 
        if (!error && (mod->usecount > 0)) {