[asterisk-commits] file: trunk r103827 - /trunk/main/file.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 19 15:38:39 CST 2008


Author: file
Date: Tue Feb 19 15:38:39 2008
New Revision: 103827

URL: http://svn.digium.com/view/asterisk?view=rev&rev=103827
Log:
Only output a log message saying the format does not exist if it actually does not exist, not if the file itself could not be opened.
(closes issue #11828)
Reported by: IgorG
Patches:
      readfile.v1.diff uploaded by IgorG (license 20)

Modified:
    trunk/main/file.c

Modified: trunk/main/file.c
URL: http://svn.digium.com/view/asterisk/trunk/main/file.c?view=diff&rev=103827&r1=103826&r2=103827
==============================================================================
--- trunk/main/file.c (original)
+++ trunk/main/file.c Tue Feb 19 15:38:39 2008
@@ -855,6 +855,7 @@
 	struct ast_format *f;
 	struct ast_filestream *fs = NULL;
 	char *fn;
+	int format_found = 0;	
 
 	AST_RWLIST_RDLOCK(&formats);
 
@@ -862,19 +863,21 @@
 		fs = NULL;
 		if (!exts_compare(f->exts, type))
 			continue;
+		else 
+			format_found = 1;
 
 		fn = build_filename(filename, type);
 		errno = 0;
 		bfile = fopen(fn, "r");
-		if (!bfile || (fs = get_filestream(f, bfile)) == NULL ||
-		    open_wrapper(fs) ) {
+
+		if (!bfile || (fs = get_filestream(f, bfile)) == NULL || open_wrapper(fs) ) {
 			ast_log(LOG_WARNING, "Unable to open %s\n", fn);
 			if (fs)
 				ast_free(fs);
 			if (bfile)
 				fclose(bfile);
 			ast_free(fn);
-			continue;
+			break;				
 		}
 		/* found it */
 		fs->trans = NULL;
@@ -887,7 +890,7 @@
 	}
 
 	AST_RWLIST_UNLOCK(&formats);
-	if (!fs) 
+	if (!format_found)
 		ast_log(LOG_WARNING, "No such format '%s'\n", type);
 
 	return fs;




More information about the asterisk-commits mailing list