libc: fix signal handling in system()
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 <1a5c02ae9e4f7b04309f886a515141ba4c3f4e44@sceen.net>
Signed-off-by: Mike Frysinger <8f3f75c74bd5184edcfa6534cab3c13a00a2f794@gentoo.org>

atgreen/uClibc-moxie,foss-for-synopsys-dwc-arc-processors/uClibc,ndmsystems/uClibc,groundwater/uClibc,kraj/uclibc-ng,ndmsystems/uClibc,ffainelli/uClibc,skristiansson/uClibc-or1k,ddcc/klee-uclibc-0.9.33.2,skristiansson/uClibc-or1k,skristiansson/uClibc-or1k,atgreen/uClibc-moxie,atgreen/uClibc-moxie,hjl-tools/uClibc,foss-for-synopsys-dwc-arc-processors/uClibc,hjl-tools/uClibc,wbx-github/uclibc-ng,groundwater/uClibc,ndmsystems/uClibc,kraj/uclibc-ng,foss-xtensa/uClibc,majek/uclibc-vx32,ddcc/klee-uclibc-0.9.33.2,foss-for-synopsys-dwc-arc-processors/uClibc,skristiansson/uClibc-or1k,hwoarang/uClibc,wbx-github/uclibc-ng,wbx-github/uclibc-ng,ffainelli/uClibc,groundwater/uClibc,waweber/uclibc-clang,hwoarang/uClibc,kraj/uclibc-ng,hjl-tools/uClibc,kraj/uClibc,ddcc/klee-uclibc-0.9.33.2,mephi42/uClibc,mephi42/uClibc,ffainelli/uClibc,hjl-tools/uClibc,foss-for-synopsys-dwc-arc-processors/uClibc,kraj/uClibc,hwoarang/uClibc,waweber/uclibc-clang,brgl/uclibc-ng,ddcc/klee-uclibc-0.9.33.2,groundwater/uClibc,mephi42/uClibc,czankel/xtensa-uclibc,waweber/uclibc-clang,mephi42/uClibc,hjl-tools/uClibc,foss-xtensa/uClibc,foss-xtensa/uClibc,foss-xtensa/uClibc,groundwater/uClibc,wbx-github/uclibc-ng,kraj/uClibc,brgl/uclibc-ng,majek/uclibc-vx32,hwoarang/uClibc,ffainelli/uClibc,brgl/uclibc-ng,kraj/uclibc-ng,czankel/xtensa-uclibc,brgl/uclibc-ng,majek/uclibc-vx32,majek/uclibc-vx32,ndmsystems/uClibc,ffainelli/uClibc,atgreen/uClibc-moxie,kraj/uClibc,czankel/xtensa-uclibc,waweber/uclibc-clang,czankel/xtensa-uclibc