changeset 374:87ae4565679d channel-fix

merge of 'a94c5265558121fe936519b5d9a5eb27f95e9d9d' and 'd348546b80847bc0d42a7b5208bb31a54f1fdfaf'
author Matt Johnston <matt@ucc.asn.au>
date Tue, 05 Dec 2006 13:28:44 +0000
parents c046b66b76cd (current diff) 70caa99bfe3a (diff)
children 8d149b812669
files
diffstat 1 files changed, 11 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/common-session.c	Thu Oct 12 03:01:10 2006 +0000
+++ b/common-session.c	Tue Dec 05 13:28:44 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) {