# HG changeset patch # User Matt Johnston # Date 1448630803 -28800 # Node ID b370b4b172d0f43458129f1a9d6b0bd23defbc09 # Parent 6ae081e631dbd49f6020245f5ce6a85687d700a0 Fix ses.channel_signal_pending race diff -r 6ae081e631db -r b370b4b172d0 common-channel.c --- a/common-channel.c Thu Nov 26 23:15:27 2015 +0800 +++ b/common-channel.c Fri Nov 27 21:26:43 2015 +0800 @@ -255,8 +255,6 @@ } } - ses.channel_signal_pending = 0; - #ifdef USING_LISTENERS handle_listeners(readfds); #endif diff -r 6ae081e631db -r b370b4b172d0 common-session.c --- a/common-session.c Thu Nov 26 23:15:27 2015 +0800 +++ b/common-session.c Fri Nov 27 21:26:43 2015 +0800 @@ -162,6 +162,7 @@ /* We get woken up when signal handlers write to this pipe. SIGCHLD in svr-chansession is the only one currently. */ FD_SET(ses.signal_pipe[0], &readfd); + ses.channel_signal_pending = 0; /* set up for channels which can be read/written */ setchannelfds(&readfd, &writefd, writequeue_has_space); @@ -211,7 +212,9 @@ wake up the select() above. */ if (FD_ISSET(ses.signal_pipe[0], &readfd)) { char x; + TRACE(("signal pipe set")) while (read(ses.signal_pipe[0], &x, 1) > 0) {} + ses.channel_signal_pending = 1; } /* check for auth timeout, rekeying required etc */