[FFmpeg-cvslog] xvid_rc: check that write() succeeded.

Michael Niedermayer git at videolan.org
Sat Feb 4 06:07:53 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Feb  4 01:09:29 2012 +0100| [25f35df11583800ee296effd42c51c65e9f3ef72] | committer: Michael Niedermayer

xvid_rc: check that write() succeeded.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=25f35df11583800ee296effd42c51c65e9f3ef72
---

 libavcodec/libxvid_rc.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libavcodec/libxvid_rc.c b/libavcodec/libxvid_rc.c
index 10a7c1c..08d306e 100644
--- a/libavcodec/libxvid_rc.c
+++ b/libavcodec/libxvid_rc.c
@@ -59,7 +59,10 @@ int ff_xvid_rate_control_init(MpegEncContext *s){
             rce->skip_count, (rce->i_tex_bits + rce->p_tex_bits + rce->misc_bits+7)/8, (rce->header_bits+rce->mv_bits+7)/8);
 
 //av_log(NULL, AV_LOG_ERROR, "%s\n", tmp);
-        write(fd, tmp, strlen(tmp));
+        if (write(fd, tmp, strlen(tmp)) < 0) {
+            av_log(NULL, AV_LOG_ERROR, "Error %s writing 2pass logfile\n", strerror(errno));
+            return AVERROR(errno);
+        }
     }
 
     close(fd);



More information about the ffmpeg-cvslog mailing list