[FFmpeg-devel] [PATCH] ffmpeg: check value of write syscall
wm4
nfxjfg at googlemail.com
Sat Jul 25 11:16:59 CEST 2015
On Sat, 25 Jul 2015 00:20:01 -0400
Ganesh Ajjanagadde <gajjanagadde at gmail.com> wrote:
> 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);
> }
> }
perror isn't async signal safe, so this makes the code less correct.
More information about the ffmpeg-devel
mailing list