[PATCH] libc: fix signal handling in system()
Rich Felker
dalias at aerifal.cx
Mon Jan 16 19:58:25 UTC 2012
On Mon, Jan 16, 2012 at 07:05:23PM +0100, Richard Braun wrote:
> On Mon, Jan 16, 2012 at 09:54:24AM -0500, Rich Felker wrote:
> > This is the THIRD time I've told you that blocking SIGCHLD rather than
> > ignoring it is non-conformant, and I provided the relevant citation
> > (link and quoted):
> >
> > The system() function shall ignore the SIGINT and SIGQUIT signals,
> > and shall block the SIGCHLD signal, while waiting for the command
> > to terminate. If this might cause the application to miss a signal
> > that would have killed it, then the application should examine the
> > return value from system() and take whatever action is appropriate
> > to the application if the command terminated due to receipt of a
> > signal.
> >
> > http://pubs.opengroup.org/onlinepubs/9699919799/functions/system.html
>
> Last cordial message before "coding under the influence" accusations :
>
> How can you read "shall block the SIGCHLD signal" and understand
> "blocking SIGCHLD rather than ignoring it is non-conformant" ? Please be
> very specific as I really don't get your point here.
OK, I'm dyslexic or something and somehow permuted the signal names
every time I read it. Sorry. I think your approach probably works, but
it also means system() is completely unsafe to use in multi-threaded
programs that handle SIGCHLD...
Rich
More information about the uClibc
mailing list