From e0ae527190ab2d7aa6d58cd50abbcde8ef32df8c Mon Sep 17 00:00:00 2001
From: Matt Johnston <matt@ucc.asn.au>
Date: Tue, 17 Nov 2015 20:53:30 +0800
Subject: [PATCH] Only clear channel_signal_pending after handling all
 channels, from Andrzej Szombierski

---
 common-channel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common-channel.c b/common-channel.c
index abe59419..b846f285 100644
--- a/common-channel.c
+++ b/common-channel.c
@@ -256,7 +256,6 @@ void channelio(fd_set *readfds, fd_set *writefds) {
 		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 */
@@ -265,6 +264,8 @@ void channelio(fd_set *readfds, fd_set *writefds) {
 		}
 	}
 
+	ses.channel_signal_pending = 0;
+
 #ifdef USING_LISTENERS
 	handle_listeners(readfds);
 #endif
-- 
GitLab