diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-02-22 02:36:00 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-02-22 02:36:00 +0000 |
commit | ac1f0d54273636ab56a7bf68e73123ec0c273381 (patch) | |
tree | 04b02e44191e4bfa901933900fb64f1efb712adf /main/loader.c | |
parent | d16479db0aa8c0b7a7d8c8224a724593e0979a59 (diff) |
give embedded modules a helping hand by backing up and restoring their global variables when they are loaded and unloaded
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@56092 f38db490-d61c-443f-a65b-d21fe96a405b
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) |