summaryrefslogtreecommitdiffhomepage
path: root/svr-chansession.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2011-03-31 14:42:11 +0000
committerMatt Johnston <matt@ucc.asn.au>2011-03-31 14:42:11 +0000
commit2303d0fd09306271cdc447ca164471be4e32e24a (patch)
tree4eb906ecdc745b405823f53a843b8c95b5fa939c /svr-chansession.c
parent9a007c30d47dad0eb052cd83c45c84b7b2320dce (diff)
Avoid segfault when handling childpid race
--HG-- extra : convert_revision : 8845727a7e2b096015dbb76d8f3df13c9acee7da
Diffstat (limited to 'svr-chansession.c')
-rw-r--r--svr-chansession.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/svr-chansession.c b/svr-chansession.c
index a914f25..0b3e833 100644
--- a/svr-chansession.c
+++ b/svr-chansession.c
@@ -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;
}
}
}