On Thu, Oct 06, 2016 at 05:10:32PM +0300, Rémi Denis-Courmont wrote:
> Le jeudi 6 octobre 2016, 14:24:52 Diego Biurrun a écrit :
> > libavdevice/bktr.c:107:12: warning: missing braces around initializer
> > ---
> >  libavdevice/bktr.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
> > index f76a163..563bbe5 100644
> > --- a/libavdevice/bktr.c
> > +++ b/libavdevice/bktr.c
> > @@ -104,7 +104,7 @@ static av_cold int bktr_init(const char *video_device,
> > int width, int height, long ioctl_frequency;
> >      char *arg;
> >      int c;
> > -    struct sigaction act = { 0 }, old;
> > +    struct sigaction act = { { 0 } }, old;
> >      int ret;
> >      char errbuf[128];
> 
> That's wrong. sigaction is _not_ defined (in standards) as a struct starting 
> with another struct. If you want to fix the warning while retaining 
> corectness, 
> you probably have to use memset() here.

This code is BSD-specific, so I don't think we care about standards in
this particular case.

> But I'd argue that it's a waste of time. This code is wrong in many worse 
> ways:
> - old is useless. You could equally pass NULL.
> - The old signal handler is not restored.
> - The old signal handler is not chained, breaking reentrancy.
> - This is also not thread-safe.

I believe you, but this is old code; I don't even want to try looking at
it again ;)

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to