Mercurial > dropbear
changeset 956:46a0b2ebc22c coverity
merge
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 28 Jul 2014 23:38:54 +0800 |
parents | e257f94ef8a7 (current diff) 36eacc322e00 (diff) |
children | 67ff2be856ff |
files | |
diffstat | 3 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/common-channel.c Mon Jul 28 22:56:07 2014 +0800 +++ b/common-channel.c Mon Jul 28 23:38:54 2014 +0800 @@ -258,6 +258,12 @@ writechannel(channel, channel->errfd, channel->extrabuf); do_check_close = 1; } + + if (ses.channel_signal_pending) { + /* SIGCHLD can change channel state for server sessions */ + do_check_close = 1; + ses.channel_signal_pending = 0; + } /* handle any channel closing etc */ if (do_check_close) {
--- a/session.h Mon Jul 28 22:56:07 2014 +0800 +++ b/session.h Mon Jul 28 23:38:54 2014 +0800 @@ -187,6 +187,7 @@ unsigned int chansize; /* the number of Channel*s allocated for channels */ unsigned int chancount; /* the number of Channel*s in use */ const struct ChanType **chantypes; /* The valid channel types */ + int channel_signal_pending; /* Flag set by sigchld handler */ /* TCP priority level for the main "port 22" tcp socket */ enum dropbear_prio socket_prio;
--- a/svr-chansession.c Mon Jul 28 22:56:07 2014 +0800 +++ b/svr-chansession.c Mon Jul 28 23:38:54 2014 +0800 @@ -89,6 +89,9 @@ const int saved_errno = errno; + /* Make channel handling code look for closed channels */ + ses.channel_signal_pending = 1; + TRACE(("enter sigchld handler")) while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { TRACE(("sigchld handler: pid %d", pid))