[PATCH] libc: make system() block SIGCHLD

Mike Frysinger vapier at gentoo.org
Sun Jan 15 23:51:15 UTC 2012


On Sunday 15 January 2012 14:36:55 Richard Braun wrote:
> On Sun, Jan 15, 2012 at 10:04:58AM -0500, Rich Felker wrote:
> > Your report is wrong. system is REQUIRED by POSIX to change the signal
> > disposition for SIGCHLD, not just to block the signal. It should
> > change it to SIG_IGN, not SIG_DFL, but for practical purposes these
> > are the same or similar.
> 
> I didn't notice that anywhere. Could you indicate where this behaviour
> is specified exactly ?

http://pubs.opengroup.org/onlinepubs/9699919799/functions/system.html
	The system() function shall ignore the SIGINT and SIGQUIT signals, and
	shall block the SIGCHLD signal, while waiting for the command to
	terminate

> > The code you sent the patch for is buggy,
> > however, since it uses signal() rather than sigaction() and thus
> > cannot correctly restore the signal disposition if it was installed
> > with sigaction().
> 
> I agree the use of signal() immediately disturbed me, but I didn't read
> its implementation. Maybe it does the job. In any case, we could use the
> occasion to fix that as well and replace signal() with sigaction() in
> the same patch.

Rich is referring to the extended aspects of signal handling that sigaction() 
enables over signal() such as sa_sigaction and sa_flags.  signal() will 
save/restore the handler just fine, but otherwise this function does subtly 
break a few things ...

if you're up for fixing the code beyond what you've already done, that'd be 
cool :)
-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/20120115/a4b29461/attachment.asc>


More information about the uClibc mailing list