[asterisk-commits] mmichelson: trunk r125855 - /trunk/apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 27 11:16:14 CDT 2008


Author: mmichelson
Date: Fri Jun 27 11:16:13 2008
New Revision: 125855

URL: http://svn.digium.com/view/asterisk?view=rev&rev=125855
Log:
Ensure the thread-safety of the monexec variable in app_queue.

Thanks to Russell for pointing out the problem


Modified:
    trunk/apps/app_queue.c

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=125855&r1=125854&r2=125855
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Fri Jun 27 11:16:13 2008
@@ -3541,10 +3541,15 @@
 			if (!qe->parent->montype) {
 				const char *monexec, *monargs;
 				ast_debug(1, "Starting Monitor as requested.\n");
-				if ((monexec = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC")) || (monargs = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC_ARGS")))
+				ast_channel_lock(qe->chan);
+				if ((monexec = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC")) || (monargs = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC_ARGS"))) {
 					which = qe->chan;
+					monexec = monexec ? ast_strdupa(monexec) : NULL;
+				}
 				else
 					which = peer;
+				ast_log(LOG_NOTICE, "poop\n");
+				ast_channel_unlock(qe->chan);
 				if (monitorfilename)
 					ast_monitor_start(which, qe->parent->monfmt, monitorfilename, 1, X_REC_IN | X_REC_OUT);
 				else if (qe->chan->cdr)




More information about the asterisk-commits mailing list