[FFmpeg-devel] patch: log when hard exiting from too many signals.

wm4 nfxjfg at googlemail.com
Wed Jun 24 13:08:39 CEST 2015


On Wed, 24 Jun 2015 13:04:27 +0200
Michael Niedermayer <michaelni at gmx.at> wrote:

> On Wed, Jun 24, 2015 at 04:28:22AM -0600, Roger Pack wrote:
> > If it looks worth anything, see attached (there's only one file).
> > Thanks!
> 
> >  ffmpeg.c |    4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 76e781dafd7324903c7cc08dbf297bd95841126c  0002-log-error-message-when-shutting-down-from-too-many-s.patch
> > From dad4f89ec0dc5bdeaeb1923e159fa12655bdde7a Mon Sep 17 00:00:00 2001
> > From: rogerdpack <rogerpack2005 at gmail.com>
> > Date: Wed, 24 Jun 2015 04:26:26 -0600
> > Subject: [PATCH 2/2] log error message when shutting down from too many
> >  signals
> > 
> > Signed-off-by: rogerdpack <rogerpack2005 at gmail.com>
> > ---
> >  ffmpeg.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/ffmpeg.c b/ffmpeg.c
> > index 720e105..6aa5d1b 100644
> > --- a/ffmpeg.c
> > +++ b/ffmpeg.c
> > @@ -324,8 +324,10 @@ sigterm_handler(int sig)
> >      received_sigterm = sig;
> >      received_nb_signals++;
> >      term_exit_sigsafe();
> > -    if(received_nb_signals > 3)
> > +    if(received_nb_signals > 3){
> 
> > +        av_log(NULL, AV_LOG_ERROR, "Received %d shutdown signals, hard exiting.", received_nb_signals);
> 
> i think its better to use fprintf(stderr,...
> here instead of av_log()
> 
> when things are already stuck for some reason staying with the
> simpler, lower level code seems more robust to me
> 
> [...]
> 

Neither av_log not printf() are safe in a signal handler.

You could use write().


More information about the ffmpeg-devel mailing list