mirror of
https://github.com/clearml/dropbear
synced 2025-02-01 19:34:11 +00:00
Make flow of execution clearer for getting process exit status
--HG-- extra : convert_revision : 9a15e5205a3fd8ac4d23118f1857db9fa9d58a90
This commit is contained in:
parent
4cb673b644
commit
c9319fbef5
@ -88,6 +88,8 @@ static void sesssigchild_handler(int UNUSED(dummy)) {
|
||||
|
||||
TRACE(("enter sigchld handler"))
|
||||
while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
|
||||
|
||||
exit = NULL;
|
||||
/* find the corresponding chansess */
|
||||
for (i = 0; i < svr_ses.childpidsize; i++) {
|
||||
if (svr_ses.childpids[i].pid == pid) {
|
||||
@ -99,7 +101,7 @@ static void sesssigchild_handler(int UNUSED(dummy)) {
|
||||
|
||||
/* If the pid wasn't matched, then we might have hit the race mentioned
|
||||
* above. So we just store the info for the parent to deal with */
|
||||
if (i == svr_ses.childpidsize) {
|
||||
if (!exit) {
|
||||
exit = &svr_ses.lastexit;
|
||||
}
|
||||
|
||||
@ -118,7 +120,6 @@ static void sesssigchild_handler(int UNUSED(dummy)) {
|
||||
/* we use this to determine how pid exited */
|
||||
exit->exitsignal = -1;
|
||||
}
|
||||
exit = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user