mirror of
https://github.com/clearml/dropbear
synced 2025-02-07 13:21:15 +00:00
Avoid segfault when handling childpid race
--HG-- extra : convert_revision : 8845727a7e2b096015dbb76d8f3df13c9acee7da
This commit is contained in:
parent
9a007c30d4
commit
2303d0fd09
@ -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->readfd);
|
||||||
ses.maxfd = MAX(ses.maxfd, channel->errfd);
|
ses.maxfd = MAX(ses.maxfd, channel->errfd);
|
||||||
|
|
||||||
|
sleep(1);
|
||||||
|
|
||||||
addchildpid(chansess, chansess->pid);
|
addchildpid(chansess, chansess->pid);
|
||||||
|
|
||||||
if (svr_ses.lastexit.exitpid != -1) {
|
if (svr_ses.lastexit.exitpid != -1) {
|
||||||
@ -705,6 +707,7 @@ static int noptycommand(struct Channel *channel, struct ChanSess *chansess) {
|
|||||||
TRACE(("found match for lastexitpid"))
|
TRACE(("found match for lastexitpid"))
|
||||||
svr_ses.childpids[i].chansess->exit = svr_ses.lastexit;
|
svr_ses.childpids[i].chansess->exit = svr_ses.lastexit;
|
||||||
svr_ses.lastexit.exitpid = -1;
|
svr_ses.lastexit.exitpid = -1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user