diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2007-02-22 02:36:00 +0000 |
---|---|---|
committer | Kevin P. Fleming <kpfleming@digium.com> | 2007-02-22 02:36:00 +0000 |
commit | 1bec2f5bfae922cc163cecb43c868e8e8ee3a66d (patch) | |
tree | 04b02e44191e4bfa901933900fb64f1efb712adf /main/loader.c | |
parent | a6cbe5d6511e984c671a6c32195d8af38fda023c (diff) |
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
Diffstat (limited to 'main/loader.c')
-rw-r--r-- | main/loader.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/main/loader.c b/main/loader.c index 65c95ecc6..4516b3779 100644 --- a/main/loader.c +++ b/main/loader.c @@ -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) |