diff options
author | Peter Bex <peter@more-magic.net> | 2017-11-09 21:26:48 +0100 |
---|---|---|
committer | Peter Bex <peter@more-magic.net> | 2017-11-09 21:26:48 +0100 |
commit | e7bf6cc5f6301e5d4be4d877b57039512379a1ec (patch) | |
tree | eeea0de6aef1bf824ee63c46272c1776222034d9 /scsh-process.release-info | |
parent | 6ffe2658fb703ddac9b7801b2f67ab0ea597472d (diff) | |
download | scsh-process-e7bf6cc5f6301e5d4be4d877b57039512379a1ec.tar.gz |
Temporarily mask sigchld to avoid race condition in fork
We do a fork, and immediately afterwards we insert a scsh-process
object into the pending processes table with the pid of the newly
created child process.
However, sigchld may arrive in between the fork and the insertion of
the scsh-process object into the pending process table. The sigchld
handler will reap the child process and attempt to update the pending
scsh-process object, but it can't find it yet because the insertion of
this object into the table happens after the fork, thus losing the
reaped child's exit status.
Then, if the program waits for the process after that, we enter an
infinite busy waiting loop that expects a sigchld to arrive and update
the object through the table, but that never happens because the child
has already been reaped.
Diffstat (limited to 'scsh-process.release-info')
0 files changed, 0 insertions, 0 deletions