[asterisk-commits] jrose: branch 11 r376391 - in /branches/11: ./ res/res_monitor.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 16 13:59:51 CST 2012


Author: jrose
Date: Fri Nov 16 13:59:45 2012
New Revision: 376391

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376391
Log:
monitor: prevent attempts to move/remove recordings skipped with 'i' and 'o'.

The i and o options for monitor skip the input and output sides of a recording
respectively. This patch addresses a problem in those options when monitor is
called without specifying a specific filename where monitor will try to move
the recording that was skipped. Since this usually doesn't exist when these
options are used, it would produce a warning when it does this in most cases,
but it is conceivable that there are use cases where this could result in
moving/removing a file unintentionally.

(closes issue ASTERISK-20641)
Reported by: Jonathan Rose
Review: https://reviewboard.asterisk.org/r/2190/
........

Merged revisions 376389 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 376390 from http://svn.asterisk.org/svn/asterisk/branches/10

Modified:
    branches/11/   (props changed)
    branches/11/res/res_monitor.c

Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: branches/11/res/res_monitor.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/res_monitor.c?view=diff&rev=376391&r1=376390&r2=376391
==============================================================================
--- branches/11/res/res_monitor.c (original)
+++ branches/11/res/res_monitor.c Fri Nov 16 13:59:45 2012
@@ -451,24 +451,28 @@
 		}
 
 		if (ast_channel_monitor(chan)->filename_changed && !ast_strlen_zero(ast_channel_monitor(chan)->filename_base)) {
-			if (ast_fileexists(ast_channel_monitor(chan)->read_filename,NULL,NULL) > 0) {
-				snprintf(filename, FILENAME_MAX, "%s-in", ast_channel_monitor(chan)->filename_base);
-				if (ast_fileexists(filename, NULL, NULL) > 0) {
-					ast_filedelete(filename, NULL);
+			if (ast_channel_monitor(chan)->read_stream) {
+				if (ast_fileexists(ast_channel_monitor(chan)->read_filename,NULL,NULL) > 0) {
+					snprintf(filename, FILENAME_MAX, "%s-in", ast_channel_monitor(chan)->filename_base);
+					if (ast_fileexists(filename, NULL, NULL) > 0) {
+						ast_filedelete(filename, NULL);
+					}
+					ast_filerename(ast_channel_monitor(chan)->read_filename, filename, ast_channel_monitor(chan)->format);
+				} else {
+					ast_log(LOG_WARNING, "File %s not found\n", ast_channel_monitor(chan)->read_filename);
 				}
-				ast_filerename(ast_channel_monitor(chan)->read_filename, filename, ast_channel_monitor(chan)->format);
-			} else {
-				ast_log(LOG_WARNING, "File %s not found\n", ast_channel_monitor(chan)->read_filename);
-			}
-
-			if (ast_fileexists(ast_channel_monitor(chan)->write_filename,NULL,NULL) > 0) {
-				snprintf(filename, FILENAME_MAX, "%s-out", ast_channel_monitor(chan)->filename_base);
-				if (ast_fileexists(filename, NULL, NULL) > 0) {
-					ast_filedelete(filename, NULL);
+			}
+
+			if (ast_channel_monitor(chan)->write_stream) {
+				if (ast_fileexists(ast_channel_monitor(chan)->write_filename,NULL,NULL) > 0) {
+					snprintf(filename, FILENAME_MAX, "%s-out", ast_channel_monitor(chan)->filename_base);
+					if (ast_fileexists(filename, NULL, NULL) > 0) {
+						ast_filedelete(filename, NULL);
+					}
+					ast_filerename(ast_channel_monitor(chan)->write_filename, filename, ast_channel_monitor(chan)->format);
+				} else {
+					ast_log(LOG_WARNING, "File %s not found\n", ast_channel_monitor(chan)->write_filename);
 				}
-				ast_filerename(ast_channel_monitor(chan)->write_filename, filename, ast_channel_monitor(chan)->format);
-			} else {
-				ast_log(LOG_WARNING, "File %s not found\n", ast_channel_monitor(chan)->write_filename);
 			}
 		}
 




More information about the asterisk-commits mailing list