Commit 0e7409c7 authored by Matt Johnston's avatar Matt Johnston
Browse files

Make sure the check_close() handler runs when a server child process exits

parent 393ca2a2
......@@ -258,6 +258,12 @@ void channelio(fd_set *readfds, fd_set *writefds) {
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) {
......
......@@ -187,6 +187,7 @@ struct sshsession {
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;
......
......@@ -89,6 +89,9 @@ static void sesssigchild_handler(int UNUSED(dummy)) {
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))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment