Mercurial > dropbear
changeset 341:2eb5a8514905
Make flow of execution clearer for getting process exit status
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 07 Jul 2006 09:18:05 +0000 |
parents | 454a34b2dfd1 |
children | 3e098639b05f |
files | svr-chansession.c |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/svr-chansession.c Fri Jul 07 09:17:18 2006 +0000 +++ b/svr-chansession.c Fri Jul 07 09:18:05 2006 +0000 @@ -88,6 +88,8 @@ 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 @@ /* 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 @@ /* we use this to determine how pid exited */ exit->exitsignal = -1; } - exit = NULL; }