[FFmpeg-devel] [PATCH 1/2] ffmpeg: use sigaction() instead of signal() on linux

Andriy Gelman andriy.gelman at gmail.com
Sun Jan 10 21:10:07 EET 2021


On Sun, 10. Jan 16:32, Zane van Iperen wrote:
> On 29/11/20 5:46 am, Andriy Gelman wrote:
> 
> >   void term_init(void)
> >   {
> > +#if defined __linux__
> > +    struct sigaction action;

Hi Zane,

Thanks for reviewing the patch.

> 
> Nit: Should this have a "= {0}"?
> 
> My sigaction(2) says:
>   On some architectures a union is involved: do not assign to both sa_handler and sa_sigaction.
> so it's possible that sa_sigaction is left uninitialised.
> 
> If I'm wrong (quite possible, it's 2am), then part 1 lgtm.
> 

SA_SIGINFO in sa_flags used to decide whether sa_handler or sa_sigaction is
chosen from the union.

But, there is one function pointer sa_restorer in struct sigaction that's
currently not initialized. The docs say this pointer is used internally by
glibc/kernel, and should not be used by applications.  It doesn't say that it
needs to be set to NULL, but I suppose it's a good practise.  I'll add your
suggestion to the patch.

Will apply the patch in a few days unless there are other comments.

-- 
Andriy


More information about the ffmpeg-devel mailing list