Module: libav
Branch: master
Commit: f7d183f08472e566a2e6b62a80e200a12670ed0e

Author:    Diego Biurrun <[email protected]>
Committer: Diego Biurrun <[email protected]>
Date:      Tue Dec  8 10:22:15 2015 +0100

libxvid: Check return value of write() call

libavcodec/libxvid_rc.c:106:9: warning: ignoring return value of ‘write’, 
declared with attribute warn_unused_result [-Wunused-result]

---

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

diff --git a/libavcodec/libxvid_rc.c b/libavcodec/libxvid_rc.c
index eddbbe8..94301a2 100644
--- a/libavcodec/libxvid_rc.c
+++ b/libavcodec/libxvid_rc.c
@@ -87,7 +87,10 @@ av_cold int ff_xvid_rate_control_init(MpegEncContext *s)
                  (rce->i_tex_bits + rce->p_tex_bits + rce->misc_bits + 7) / 8,
                  (rce->header_bits + rce->mv_bits + 7) / 8);
 
-        write(fd, tmp, strlen(tmp));
+        if (strlen(tmp) > write(fd, tmp, strlen(tmp))) {
+            av_log(s, AV_LOG_ERROR, "Cannot write to temporary pass2 file.\n");
+            return AVERROR(EIO);
+        }
     }
 
     close(fd);

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to