[asterisk-commits] mnicholson: branch 1.6.1 r158855 - in /branches/1.6.1: ./ main/file.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 24 15:44:04 CST 2008


Author: mnicholson
Date: Mon Nov 24 15:44:03 2008
New Revision: 158855

URL: http://svn.digium.com/view/asterisk?view=rev&rev=158855
Log:
Merged revisions 158851 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r158851 | mnicholson | 2008-11-24 15:27:26 -0600 (Mon, 24 Nov 2008) | 6 lines
  
  Make ast_streamfile() check the result of ast_openstream() before doing
  anything with it.
  
  (closes issue #13955)
  Reported by: chris-mac
........

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/main/file.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/main/file.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/main/file.c?view=diff&rev=158855&r1=158854&r2=158855
==============================================================================
--- branches/1.6.1/main/file.c (original)
+++ branches/1.6.1/main/file.c Mon Nov 24 15:44:03 2008
@@ -900,6 +900,10 @@
 	int seekattempt;
 
 	fs = ast_openstream(chan, filename, preflang);
+	if (!fs) {
+		ast_log(LOG_WARNING, "Unable to open %s (format %s): %s\n", filename, ast_getformatname_multiple(fmt, sizeof(fmt), chan->nativeformats), strerror(errno));
+		return -1;
+	}
 
 	/* check to see if there is any data present (not a zero length file),
 	 * done this way because there is no where for ast_openstream_full to
@@ -910,28 +914,24 @@
 	else
 		return 0;
 
-	if (fs)
-		vfs = ast_openvstream(chan, filename, preflang);
+	vfs = ast_openvstream(chan, filename, preflang);
 	if (vfs) {
 		ast_debug(1, "Ooh, found a video stream, too, format %s\n", ast_getformatname(vfs->fmt->format));
 	}
-	if (fs){
-		int res;
-		if (ast_test_flag(chan, AST_FLAG_MASQ_NOSTREAM))
-			fs->orig_chan_name = ast_strdup(chan->name);
-		if (ast_applystream(chan, fs))
-			return -1;
-		if (vfs && ast_applystream(chan, vfs))
-			return -1;
-		res = ast_playstream(fs);
-		if (!res && vfs)
-			res = ast_playstream(vfs);
-		ast_verb(3, "<%s> Playing '%s.%s' (language '%s')\n", chan->name, filename, ast_getformatname(chan->writeformat), preflang ? preflang : "default");
-
-		return res;
-	}
-	ast_log(LOG_WARNING, "Unable to open %s (format %s): %s\n", filename, ast_getformatname_multiple(fmt, sizeof(fmt), chan->nativeformats), strerror(errno));
-	return -1;
+
+	int res;
+	if (ast_test_flag(chan, AST_FLAG_MASQ_NOSTREAM))
+		fs->orig_chan_name = ast_strdup(chan->name);
+	if (ast_applystream(chan, fs))
+		return -1;
+	if (vfs && ast_applystream(chan, vfs))
+		return -1;
+	res = ast_playstream(fs);
+	if (!res && vfs)
+		res = ast_playstream(vfs);
+	ast_verb(3, "<%s> Playing '%s.%s' (language '%s')\n", chan->name, filename, ast_getformatname(chan->writeformat), preflang ? preflang : "default");
+
+	return res;
 }
 
 struct ast_filestream *ast_readfile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode)




More information about the asterisk-commits mailing list