[PATCH] libc: make system() block SIGCHLD

Richard Braun rbraun at sceen.net
Sat Jan 14 07:43:40 UTC 2012


On Fri, Jan 13, 2012 at 10:09:04PM -0500, Rich Felker wrote:
> sigprocmask alone is not sufficient to implement the required behavior
> for system. In particular, in a multi-threaded program, another thread
> will receive the signal and reap the child, causing system to
> malfunction. Really there's no safe way to use system in a
> multi-threaded program (or whatsoever, IMO), but to conform to POSIX
> it must block SIGCHLD:

Agreed. This is why I didn't use pthread_sigmask(). I mention
Linuxthreads because there are two variants of the system() function in
uClibc, and the other one, which depends on defined
__UCLIBC_HAS_THREADS_NATIVE__ && !defined __sparc__, isn't concerned by
this issue.

-- 
Richard Braun


More information about the uClibc mailing list