summaryrefslogtreecommitdiffstats
path: root/src/core/resolv.c
diff options
context:
space:
mode:
authorMichael Brown2007-01-19 15:20:41 +0100
committerMichael Brown2007-01-19 15:20:41 +0100
commitd6909f65f06856a9259bfe1c6a2ba43ee9aa1ce3 (patch)
treeec1c1fa1dfcb86f80bd72ea07a4dcb584bb35170 /src/core/resolv.c
parentNote that the SIGCHLD handler could be re-entered. (diff)
downloadipxe-d6909f65f06856a9259bfe1c6a2ba43ee9aa1ce3.tar.gz
ipxe-d6909f65f06856a9259bfe1c6a2ba43ee9aa1ce3.tar.xz
ipxe-d6909f65f06856a9259bfe1c6a2ba43ee9aa1ce3.zip
Actually, it's probably safer *not* to leave child processes hanging
around which still hold pointers to variables belonging to our parent...
Diffstat (limited to 'src/core/resolv.c')
-rw-r--r--src/core/resolv.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/core/resolv.c b/src/core/resolv.c
index d52c7481..52ad4b63 100644
--- a/src/core/resolv.c
+++ b/src/core/resolv.c
@@ -106,18 +106,16 @@ static void resolv_sigchld ( struct async *async,
/* Reap the child */
async_wait ( async, &rc, 1 );
- /* If this child succeeded, kill all the others and return.
- * Killing the others means that this routine may be
- * re-entered; this is safe provided that no child returns a
- * success exit status when killed by SIGKILL.
+ /* If this child succeeded, kill all the others. They should
+ * immediately die (invoking resolv_sigchld() again, which
+ * won't do anything because the exit status is non-zero and
+ * the pending count won't reach zero until this instance
+ * completes).
*/
- if ( rc == 0 ) {
+ if ( rc == 0 )
async_signal_children ( async, SIGKILL );
- async_done ( async, 0 );
- return;
- }
- /* If we have no children left, return failure */
+ /* When we have no children left, exit */
if ( --(resolution->pending) == 0 )
async_done ( async, rc );
}
@@ -135,6 +133,7 @@ static void resolv_reap ( struct async *async ) {
static struct async_operations resolv_async_operations = {
.reap = resolv_reap,
.signal = {
+ [SIGKILL] = async_signal_children,
[SIGCHLD] = resolv_sigchld,
},
};