- (djm) fix select hack in serverloop.c from Philippe WILLEM
   <Philippe.WILLEM@urssaf.fr>
diff --git a/CREDITS b/CREDITS
index 139f617..8831cdd 100644
--- a/CREDITS
+++ b/CREDITS
@@ -67,6 +67,7 @@
 Peter Kocks <peter.kocks@baygate.com> - Makefile fixes
 Phil Hands <phil@hands.com> - Debian scripts, assorted patches
 Phil Karn <karn@ka9q.ampr.org> - Autoconf fixes
+Philippe WILLEM <Philippe.WILLEM@urssaf.fr> - Bugfixes
 Phill Camp <P.S.S.Camp@ukc.ac.uk> - login code fix
 Rip Loomis <loomisg@cist.saic.com> - Solaris package support, fixes
 SAKAI Kiyotaka <ksakai@kso.netwk.ntt-at.co.jp> - Multiple bugfixes
diff --git a/ChangeLog b/ChangeLog
index 9cfb58d..79f9c7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+20001028
+ - (djm) fix select hack in serverloop.c from Philippe WILLEM 
+   <Philippe.WILLEM@urssaf.fr>
+
 20001027
  - (djm) Increase REKEY_BYTES to 2^24 for arc4random
 
diff --git a/serverloop.c b/serverloop.c
index d98d74c..a9e4787 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -99,9 +99,10 @@
 			error("Strange, got SIGCHLD and wait returned pid %d but child is %d",
 			      wait_pid, child_pid);
 		if (WIFEXITED(child_wait_status) ||
-		    WIFSIGNALED(child_wait_status))
+		    WIFSIGNALED(child_wait_status)) {
 			child_terminated = 1;
 			child_has_selected = 0;
+		}
 	}
 	signal(SIGCHLD, sigchld_handler);
 	errno = save_errno;
@@ -112,6 +113,7 @@
 	int save_errno = errno;
 	debug("Received SIGCHLD.");
 	child_terminated = 1;
+	child_has_selected = 0;
 	errno = save_errno;
 }
 
@@ -678,6 +680,7 @@
 			while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
 				session_close_by_pid(pid, status);
 			child_terminated = 0;
+			child_has_selected = 0;
 			signal(SIGCHLD, sigchld_handler2);
 		}
 		channel_after_select(&readset, &writeset);