aboutsummaryrefslogtreecommitdiffstats
path: root/main/file.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-19 21:38:39 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-19 21:38:39 +0000
commit25e78c8a05e0a52b1c7dcd918dc7e7981f421ba9 (patch)
treeed80b840134119cb03426726d5300e611f27a4de /main/file.c
parentd97d910f61a89e2386d53d8576faad4828bb2c0b (diff)
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) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@103827 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/file.c')
-rw-r--r--main/file.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/main/file.c b/main/file.c
index 6b37f1602..2285173e7 100644
--- a/main/file.c
+++ b/main/file.c
@@ -855,6 +855,7 @@ struct ast_filestream *ast_readfile(const char *filename, const char *type, cons
struct ast_format *f;
struct ast_filestream *fs = NULL;
char *fn;
+ int format_found = 0;
AST_RWLIST_RDLOCK(&formats);
@@ -862,19 +863,21 @@ struct ast_filestream *ast_readfile(const char *filename, const char *type, cons
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 @@ struct ast_filestream *ast_readfile(const char *filename, const char *type, cons
}
AST_RWLIST_UNLOCK(&formats);
- if (!fs)
+ if (!format_found)
ast_log(LOG_WARNING, "No such format '%s'\n", type);
return fs;