Avoid segfault when handling childpid race

--HG--
extra : convert_revision : 8845727a7e2b096015dbb76d8f3df13c9acee7da
This commit is contained in:
Matt Johnston 2011-03-31 14:42:11 +00:00
parent 9a007c30d4
commit 2303d0fd09

View File

@ -692,6 +692,8 @@ static int noptycommand(struct Channel *channel, struct ChanSess *chansess) {
ses.maxfd = MAX(ses.maxfd, channel->readfd);
ses.maxfd = MAX(ses.maxfd, channel->errfd);
sleep(1);
addchildpid(chansess, chansess->pid);
if (svr_ses.lastexit.exitpid != -1) {
@ -705,6 +707,7 @@ static int noptycommand(struct Channel *channel, struct ChanSess *chansess) {
TRACE(("found match for lastexitpid"))
svr_ses.childpids[i].chansess->exit = svr_ses.lastexit;
svr_ses.lastexit.exitpid = -1;
break;
}
}
}