avfilter: Read errno before av_log() as the callback from av_log() might affect errno

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-10-25 13:19:41 +02:00
parent a630969535
commit 0d96d44c4f
2 changed files with 4 additions and 2 deletions

View File

@ -176,8 +176,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
return AVERROR(AVERROR_EXTERNAL); return AVERROR(AVERROR_EXTERNAL);
} else { } else {
if (vsWriteToFile(md, sd->f, &localmotions) != VS_OK) { if (vsWriteToFile(md, sd->f, &localmotions) != VS_OK) {
int ret = AVERROR(errno);
av_log(ctx, AV_LOG_ERROR, "cannot write to transform file"); av_log(ctx, AV_LOG_ERROR, "cannot write to transform file");
return AVERROR(errno); return ret;
} }
vs_vector_del(&localmotions); vs_vector_del(&localmotions);
} }

View File

@ -208,8 +208,9 @@ static int config_input(AVFilterLink *inlink)
f = fopen(tc->input, "r"); f = fopen(tc->input, "r");
if (!f) { if (!f) {
int ret = AVERROR(errno);
av_log(ctx, AV_LOG_ERROR, "cannot open input file %s\n", tc->input); av_log(ctx, AV_LOG_ERROR, "cannot open input file %s\n", tc->input);
return AVERROR(errno); return ret;
} else { } else {
VSManyLocalMotions mlms; VSManyLocalMotions mlms;
if (vsReadLocalMotionsFile(f, &mlms) == VS_OK) { if (vsReadLocalMotionsFile(f, &mlms) == VS_OK) {