]> git.sesse.net Git - x264/commitdiff
matroska: mk_close: Check fseek() return value
authorHenrik Gramner <henrik@gramner.com>
Fri, 5 Feb 2016 17:46:13 +0000 (18:46 +0100)
committerHenrik Gramner <henrik@gramner.com>
Mon, 11 Apr 2016 14:58:22 +0000 (16:58 +0200)
output/matroska_ebml.c

index aa2b4489380f631c863375e83193108eb9f2b014..6d6c760e0cea703e1ee559a693acaa8f679733ef 100644 (file)
@@ -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;
     }