Message ID | 20211130004950.30697-2-cus@passwd.hu |
---|---|
State | Accepted |
Commit | 8a40cfa4dab461643f4f93f3340c897d708ea221 |
Headers | show |
Series | [FFmpeg-devel,1/5] avformat/file: use proper return value in file_close | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | success | Make fate finished |
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 5da4dea7b6..d65c7b535d 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -1231,6 +1231,7 @@ int avio_close(AVIOContext *s) { FFIOContext *const ctx = ffiocontext(s); URLContext *h; + int ret, error; if (!s) return 0; @@ -1249,9 +1250,14 @@ int avio_close(AVIOContext *s) ctx->bytes_read, ctx->seek_count); av_opt_free(s); + error = s->error; avio_context_free(&s); - return ffurl_close(h); + ret = ffurl_close(h); + if (ret < 0) + return ret; + + return error; } int avio_closep(AVIOContext **s)
Otherwise IO errors at avio_flush() before closing may be lost. Signed-off-by: Marton Balint <cus@passwd.hu> --- libavformat/aviobuf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)