From 4a1aaf52ae4189e660ad57ba69253f54603a2beb Mon Sep 17 00:00:00 2001 From: mogorman Date: Tue, 3 Oct 2006 15:53:07 +0000 Subject: bug #8076 check option_debug before printing to debug channel. patch provided in bugnote, with minor changes. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44253 f38db490-d61c-443f-a65b-d21fe96a405b --- res/res_monitor.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'res/res_monitor.c') diff --git a/res/res_monitor.c b/res/res_monitor.c index b1739f977..793921b42 100644 --- a/res/res_monitor.c +++ b/res/res_monitor.c @@ -47,6 +47,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/app.h" #include "asterisk/utils.h" #include "asterisk/config.h" +#include "asterisk/options.h" AST_MUTEX_DEFINE_STATIC(monitorlock); @@ -221,8 +222,9 @@ int ast_monitor_start( struct ast_channel *chan, const char *format_spec, /* so we know this call has been monitored in case we need to bill for it or something */ pbx_builtin_setvar_helper(chan, "__MONITORED","true"); } else { - ast_log(LOG_DEBUG,"Cannot start monitoring %s, already monitored\n", - chan->name); + if (option_debug) + ast_log(LOG_DEBUG,"Cannot start monitoring %s, already monitored\n", + chan->name); res = -1; } @@ -295,7 +297,8 @@ int ast_monitor_stop(struct ast_channel *chan, int need_lock) snprintf(tmp2,sizeof(tmp2), "( %s& rm -f \"%s/%s-\"* ) &",tmp, dir ,name); /* remove legs when done mixing */ ast_copy_string(tmp, tmp2, sizeof(tmp)); } - ast_log(LOG_DEBUG,"monitor executing %s\n",tmp); + if (option_debug) + ast_log(LOG_DEBUG,"monitor executing %s\n",tmp); if (ast_safe_system(tmp) == -1) ast_log(LOG_WARNING, "Execute of %s failed.\n",tmp); } -- cgit v1.2.3