From: Henrik Gramner Date: Fri, 5 Feb 2016 17:46:13 +0000 (+0100) Subject: matroska: mk_close: Check fseek() return value X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=1ce062abb47ac59621b402cb26a1f14c91bb52bc;p=x264 matroska: mk_close: Check fseek() return value --- diff --git a/output/matroska_ebml.c b/output/matroska_ebml.c index aa2b4489..6d6c760e 100644 --- a/output/matroska_ebml.c +++ b/output/matroska_ebml.c @@ -499,10 +499,10 @@ int mk_close( mk_writer *w, int64_t last_delta ) ret = -1; if( w->wrote_header && x264_is_regular_file( w->fp ) ) { - fseek( w->fp, w->duration_ptr, SEEK_SET ); int64_t last_frametime = w->def_duration ? w->def_duration : last_delta; - int64_t total_duration = w->max_frame_tc+last_frametime; - if( mk_write_float_raw( w->root, (float)((double)total_duration / w->timescale) ) < 0 || + int64_t total_duration = w->max_frame_tc + last_frametime; + if( fseek( w->fp, w->duration_ptr, SEEK_SET ) || + mk_write_float_raw( w->root, (float)((double)total_duration / w->timescale) ) < 0 || mk_flush_context_data( w->root ) < 0 ) ret = -1; }