OSDN Git Service

libc: fix signal handling in system()
authorRichard Braun <rbraun@sceen.net>
Tue, 17 Jan 2012 09:33:10 +0000 (10:33 +0100)
committerMike Frysinger <vapier@gentoo.org>
Tue, 24 Jan 2012 02:22:06 +0000 (21:22 -0500)
commiteb72efd81e0d5be6c836c5a084cc65b9734f544d
tree63c9a7af8f5a5a4d9d282de7a1d57249bd5a8c98
parent3837739512e6029786d4e70be658fde8172c3829
libc: fix signal handling in system()

When built without NPTL support (or for a sparc target), the system()
function doesn't conform to its specification. Namely, it uses signal()
to install/save/restore signal handlers, which may break applications
using custom handlers installed with sigaction(). In addition, it resets
the SIGCHLD handler to SIG_DFL instead of blocking the signal, which may
result in "lost" signals if a custom handler was installed.

Fix system() by replacing uses of signal() with appropriate calls to
sigaction() and sigprocmask().

Signed-off-by: Richard Braun <rbraun@sceen.net>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
libc/stdlib/system.c