# HG changeset patch # User Matt Johnston # Date 1152263885 0 # Node ID 2eb5a85149058b2c44d701b1eb51e70318667cf7 # Parent 454a34b2dfd1332d39133d76c7c5310adc1844b1 Make flow of execution clearer for getting process exit status diff -r 454a34b2dfd1 -r 2eb5a8514905 svr-chansession.c --- 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; }