[asterisk-commits] qwell: branch 1.4 r70554 - /branches/1.4/cdr/cdr_pgsql.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 20 17:31:36 CDT 2007


Author: qwell
Date: Wed Jun 20 17:31:35 2007
New Revision: 70554

URL: http://svn.digium.com/view/asterisk?view=rev&rev=70554
Log:
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.

Modified:
    branches/1.4/cdr/cdr_pgsql.c

Modified: branches/1.4/cdr/cdr_pgsql.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/cdr/cdr_pgsql.c?view=diff&rev=70554&r1=70553&r2=70554
==============================================================================
--- branches/1.4/cdr/cdr_pgsql.c (original)
+++ branches/1.4/cdr/cdr_pgsql.c Wed Jun 20 17:31:35 2007
@@ -311,8 +311,12 @@
 
 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",




More information about the asterisk-commits mailing list