[FFmpeg-devel] [PATCH] ffmpeg: check value of write syscall

Ganesh Ajjanagadde gajjanagadde at gmail.com
Sat Jul 25 06:20:01 CEST 2015


This makes code slightly more robust and fixes a -Wunused-result

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
 ffmpeg.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 751c7d3..aab53e8 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -322,13 +322,15 @@ static int main_return_code = 0;
 static void
 sigterm_handler(int sig)
 {
+    ssize_t num_write;
     received_sigterm = sig;
     received_nb_signals++;
     term_exit_sigsafe();
     if(received_nb_signals > 3) {
-        write(2/*STDERR_FILENO*/, "Received > 3 system signals, hard exiting\n",
+        num_write = write(2/*STDERR_FILENO*/, "Received > 3 system signals, hard exiting\n",
                            strlen("Received > 3 system signals, hard exiting\n"));
-
+        if(num_write < 0)
+            perror("write");
         exit(123);
     }
 }
-- 
2.4.6



More information about the ffmpeg-devel mailing list