# HG changeset patch # User Matt Johnston # Date 1406561934 -28800 # Node ID 46a0b2ebc22cb37580abbe2c68dfc96dfa7914b8 # Parent e257f94ef8a7f3f8ead46d53c3a40ccdfae44c3d# Parent 36eacc322e00924e511810c519bf5a3f05898cdd merge diff -r e257f94ef8a7 -r 46a0b2ebc22c common-channel.c --- 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) { diff -r e257f94ef8a7 -r 46a0b2ebc22c session.h --- 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; diff -r e257f94ef8a7 -r 46a0b2ebc22c svr-chansession.c --- 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))