summaryrefslogtreecommitdiff
path: root/serverloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'serverloop.c')
-rw-r--r--serverloop.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/serverloop.c b/serverloop.c
index d98d74c25..a9e478764 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -99,9 +99,10 @@ sigchld_handler(int sig)
99 error("Strange, got SIGCHLD and wait returned pid %d but child is %d", 99 error("Strange, got SIGCHLD and wait returned pid %d but child is %d",
100 wait_pid, child_pid); 100 wait_pid, child_pid);
101 if (WIFEXITED(child_wait_status) || 101 if (WIFEXITED(child_wait_status) ||
102 WIFSIGNALED(child_wait_status)) 102 WIFSIGNALED(child_wait_status)) {
103 child_terminated = 1; 103 child_terminated = 1;
104 child_has_selected = 0; 104 child_has_selected = 0;
105 }
105 } 106 }
106 signal(SIGCHLD, sigchld_handler); 107 signal(SIGCHLD, sigchld_handler);
107 errno = save_errno; 108 errno = save_errno;
@@ -112,6 +113,7 @@ sigchld_handler2(int sig)
112 int save_errno = errno; 113 int save_errno = errno;
113 debug("Received SIGCHLD."); 114 debug("Received SIGCHLD.");
114 child_terminated = 1; 115 child_terminated = 1;
116 child_has_selected = 0;
115 errno = save_errno; 117 errno = save_errno;
116} 118}
117 119
@@ -678,6 +680,7 @@ server_loop2(void)
678 while ((pid = waitpid(-1, &status, WNOHANG)) > 0) 680 while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
679 session_close_by_pid(pid, status); 681 session_close_by_pid(pid, status);
680 child_terminated = 0; 682 child_terminated = 0;
683 child_has_selected = 0;
681 signal(SIGCHLD, sigchld_handler2); 684 signal(SIGCHLD, sigchld_handler2);
682 } 685 }
683 channel_after_select(&readset, &writeset); 686 channel_after_select(&readset, &writeset);