[PATCH] libc: fix signal handling in system()

Mike Frysinger vapier at gentoo.org
Tue Jan 17 06:50:55 UTC 2012


On Tuesday 17 January 2012 01:38:57 Richard Braun wrote:
> On Mon, Jan 16, 2012 at 10:52:58PM -0500, Mike Frysinger wrote:
> > this leaves the other fields of sigaction uninitialized.  i think we need:
> >  	if (command == 0)
> >  		return 1;
> > 
> > +	memset(&sa, 0, sizeof(sa));
> >  	sa.sa_handler = SIG_IGN;
> >  	sigemptyset(&sa.sa_mask);
> > -	sa.sa_flags = 0;
> >  	sigaction(SIGQUIT, &sa, &save_quit);
> >  	sigaction(SIGINT, &sa, &save_int);
> >  	sigaddset(&sa.sa_mask, SIGCHLD);
> 
> I didn't realize this. But then, do we need to call sigemptyset() ?

if we want to be tricky and rely on the semantics there, then we can do that.  
in this case, i'd comment out the sigemptyset() and mention that the memset 
took care of it for us.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20120117/1914c782/attachment.asc>


More information about the uClibc mailing list