]> git.itanic.dy.fi Git - rrdd/commit
process: sigchild_handler: Only call waitpid()
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sun, 15 Apr 2012 19:03:21 +0000 (22:03 +0300)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sun, 15 Apr 2012 19:03:21 +0000 (22:03 +0300)
commitd937146d6ee5f5498d03e390c9adc3443826c937
tree667cde696305694584a8e815fbb6776961fe5af9
parent91926b251cbab9dd8221d0cb00579d3aeb4dfc71
process: sigchild_handler: Only call waitpid()

Calling any *printf* functions from a signal handler is unsafe. If the
interrupted process happened to be in the middle of a printf call
during the arrival of the signal, the signal handler can freeze
silently.

To avoid this, the sigchild handler will no longer call
harvest_zombies() to clear out the zombie processes. This hides the
exit status of the process, but that is not that significant
information.

An alternative way would be to simply do nothing in the signal handler
except set some flag indicating the death of a child. The signal would
cause the epoll_wait to fail with EINTR error that can be used to
trigger waitpid.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
process.c