diff options
author | Timothy Gu <timothygu99@gmail.com> | 2014-03-29 20:59:45 +0000 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2014-03-30 14:55:08 +0200 |
commit | 9e4e35b4d7c43a908944183a58aa389a23116fd6 (patch) | |
tree | 4e47fbc62617080c145525b8b0b4f2bebf013bf2 | |
parent | 508a84e6726ab94a740c160b30fd8162265d1fef (diff) | |
download | ffmpeg-9e4e35b4d7c43a908944183a58aa389a23116fd6.tar.gz |
avconv_opt: fix avio_open2() return code check
avio_open2() only return < 0 when error.
-rw-r--r-- | avconv_opt.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/avconv_opt.c b/avconv_opt.c index 7bc41c96b2..fc57f6be49 100644 --- a/avconv_opt.c +++ b/avconv_opt.c @@ -819,14 +819,14 @@ static uint8_t *get_line(AVIOContext *s) static int get_preset_file_2(const char *preset_name, const char *codec_name, AVIOContext **s) { - int i, ret = 1; + int i, ret = -1; char filename[1000]; const char *base[3] = { getenv("AVCONV_DATADIR"), getenv("HOME"), AVCONV_DATADIR, }; - for (i = 0; i < FF_ARRAY_ELEMS(base) && ret; i++) { + for (i = 0; i < FF_ARRAY_ELEMS(base) && ret < 0; i++) { if (!base[i]) continue; if (codec_name) { @@ -834,7 +834,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV i != 1 ? "" : "/.avconv", codec_name, preset_name); ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL); } - if (ret) { + if (ret < 0) { snprintf(filename, sizeof(filename), "%s%s/%s.avpreset", base[i], i != 1 ? "" : "/.avconv", preset_name); ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL); |