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

Michael Niedermayer michaelni at gmx.at
Thu Jun 25 12:25:12 CEST 2015


On Wed, Jun 24, 2015 at 11:46:07PM -0600, Roger Pack wrote:
> On 6/24/15, wm4 <nfxjfg at googlemail.com> wrote:
> > 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().
> 
> I'm not as familiar with write, unfortunately.  Here's a printf
> version FWIW, feel free to rewrite it as desired.

applied with write()

thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150625/182532e9/attachment.asc>


More information about the ffmpeg-devel mailing list