mirror of
https://github.com/clearml/dropbear
synced 2025-02-02 03:43:53 +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"))
|
TRACE(("enter sigchld handler"))
|
||||||
while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
|
while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
|
||||||
|
|
||||||
|
exit = NULL;
|
||||||
/* find the corresponding chansess */
|
/* find the corresponding chansess */
|
||||||
for (i = 0; i < svr_ses.childpidsize; i++) {
|
for (i = 0; i < svr_ses.childpidsize; i++) {
|
||||||
if (svr_ses.childpids[i].pid == pid) {
|
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
|
/* 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 */
|
* above. So we just store the info for the parent to deal with */
|
||||||
if (i == svr_ses.childpidsize) {
|
if (!exit) {
|
||||||
exit = &svr_ses.lastexit;
|
exit = &svr_ses.lastexit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +120,6 @@ static void sesssigchild_handler(int UNUSED(dummy)) {
|
|||||||
/* we use this to determine how pid exited */
|
/* we use this to determine how pid exited */
|
||||||
exit->exitsignal = -1;
|
exit->exitsignal = -1;
|
||||||
}
|
}
|
||||||
exit = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user