# HG changeset patch # User Matt Johnston # Date 1165325279 0 # Node ID 70caa99bfe3a0b69f8d567b18bde09778a809751 # Parent 49fcc98750453baab89555ef04a94dbf2710420a Tidy up behaviour when select() is interrupted. We follow normal codepaths, just with no FDs set. diff -r 49fcc9875045 -r 70caa99bfe3a common-session.c --- a/common-session.c Wed Oct 11 14:44:00 2006 +0000 +++ b/common-session.c Tue Dec 05 13:27:59 2006 +0000 @@ -143,27 +143,21 @@ dropbear_exit("Terminated by signal"); } - if (val < 0) { - if (errno == EINTR) { - /* This must happen even if we've been interrupted, so that - * changed signal-handler vars can take effect etc */ - if (loophandler) { - loophandler(); - } - continue; - } else { - dropbear_exit("Error in select"); - } + if (val < 0 && errno != EINTR) { + dropbear_exit("Error in select"); + } + + if (val <= 0) { + /* If we were interrupted or the select timed out, we still + * want to iterate over channels etc for reading, to handle + * server processes exiting etc. + * We don't want to read/write FDs. */ + FD_ZERO(&writefd); + FD_ZERO(&readfd); } /* check for auth timeout, rekeying required etc */ checktimeouts(); - - if (val == 0) { - /* timeout */ - TRACE(("select timeout")) - continue; - } /* process session socket's incoming/outgoing data */ if (ses.sock != -1) {