diff common-session.c @ 402:173a5f89666c channel-fix

propagate from branch 'au.asn.ucc.matt.dropbear' (head b1dd3b94e60a07a176dba2b035ac79968595990a) to branch 'au.asn.ucc.matt.dropbear.channel-fix' (head fc77c3dea87a7c0f374e738d055f0b455495cbc3)
author Matt Johnston <matt@ucc.asn.au>
date Sat, 03 Feb 2007 08:22:58 +0000
parents 70caa99bfe3a
children a01c0c8e543a
line wrap: on
line diff
--- a/common-session.c	Sat Feb 03 08:20:34 2007 +0000
+++ b/common-session.c	Sat Feb 03 08:22:58 2007 +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) {