diff --git a/main/file.c b/main/file.c index c71e80d167..ed203cea76 100644 --- a/main/file.c +++ b/main/file.c @@ -678,6 +678,11 @@ static int filehelper(const char *filename, const void *arg2, const char *fmt, c } ast_free(fn); } + + /* If we have successfully opened a file, we are done. */ + if (action == ACTION_OPEN && res == 1) { + break; + } } AST_RWLIST_UNLOCK(&formats); return res;