mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-20 00:30:20 +00:00
give embedded modules a helping hand by backing up and restoring their global variables when they are loaded and unloaded
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@56092 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -483,6 +483,9 @@ int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode f
|
||||
if (!error)
|
||||
ast_update_use_count();
|
||||
|
||||
if (!error && !mod->lib)
|
||||
mod->info->restore_globals();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -627,6 +630,11 @@ static enum ast_module_load_result load_resource(const char *resource_name, unsi
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
}
|
||||
|
||||
if (!mod->lib && mod->info->backup_globals()) {
|
||||
ast_log(LOG_WARNING, "Module '%s' was unable to backup its global data.\n", resource_name);
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
}
|
||||
|
||||
ast_clear_flag(mod, FLAG_DECLINED);
|
||||
|
||||
if (mod->info->load)
|
||||
|
||||
Reference in New Issue
Block a user