diff options
author | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-20 22:31:35 +0000 |
---|---|---|
committer | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-20 22:31:35 +0000 |
commit | 67b09b18eefec557683ca8ee6ab3aa43289ab22f (patch) | |
tree | e7369c28d9961ad6288386144c40ee8e60f2b258 /cdr | |
parent | d40c1d823df09e242097e76f27a98f03f62738b5 (diff) |
Fix a race condition in cdr_pgsql that can occur when reloading the module.
Issue 10022, patch by me, with credit to prashant_jois for finding the bug.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@70554 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr')
-rw-r--r-- | cdr/cdr_pgsql.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c index 7788cf037..14f343abd 100644 --- a/cdr/cdr_pgsql.c +++ b/cdr/cdr_pgsql.c @@ -311,8 +311,12 @@ static int unload_module(void) static int reload(void) { + int res; + ast_mutex_lock(&pgsql_lock); my_unload_module(); - return my_load_module(); + res = my_load_module(); + ast_mutex_lock(&pgsql_lock); + return res; } AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "PostgreSQL CDR Backend", |