Mercurial > dropbear
diff common-session.c @ 373:70caa99bfe3a channel-fix
Tidy up behaviour when select() is interrupted. We follow normal
codepaths, just with no FDs set.
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 05 Dec 2006 13:27:59 +0000 |
parents | bf29e6659fb9 |
children | a01c0c8e543a |
line wrap: on
line diff
--- 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) {