Index: file.c =================================================================== --- file.c (revision 7849) +++ file.c (working copy) @@ -356,22 +356,15 @@ static int ast_filehelper(const char *fi struct ast_channel *chan = (struct ast_channel *)filename2; /* Start with negative response */ - if (action == ACTION_EXISTS) - res = 0; - else - res = -1; + res = (action == ACTION_EXISTS) ? 0 : -1; if (action == ACTION_OPEN) ret = -1; /* Check for a specific format */ if (ast_mutex_lock(&formatlock)) { ast_log(LOG_WARNING, "Unable to lock format list\n"); - if (action == ACTION_EXISTS) - return 0; - else - return -1; + return res; } - f = formats; - while(f) { + for (f = formats; f; f = f->next) { if (!fmt || exts_compare(f->exts, fmt)) { char *stringp=NULL; exts = ast_strdupa(f->exts); @@ -452,7 +445,6 @@ static int ast_filehelper(const char *fi } while(ext); } - f = f->next; } ast_mutex_unlock(&formatlock); if ((action == ACTION_EXISTS) || (action == ACTION_OPEN))