diff options
Diffstat (limited to 'serverloop.c')
-rw-r--r-- | serverloop.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/serverloop.c b/serverloop.c index cacf0ad42..38b1cf7ba 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$OpenBSD: serverloop.c,v 1.100 2002/03/24 16:00:27 markus Exp $"); | 38 | RCSID("$OpenBSD: serverloop.c,v 1.101 2002/03/30 18:51:15 markus Exp $"); |
39 | 39 | ||
40 | #include "xmalloc.h" | 40 | #include "xmalloc.h" |
41 | #include "packet.h" | 41 | #include "packet.h" |
@@ -670,10 +670,10 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg) | |||
670 | /* We no longer want our SIGCHLD handler to be called. */ | 670 | /* We no longer want our SIGCHLD handler to be called. */ |
671 | mysignal(SIGCHLD, SIG_DFL); | 671 | mysignal(SIGCHLD, SIG_DFL); |
672 | 672 | ||
673 | wait_pid = waitpid(-1, &wait_status, 0); | 673 | while ((wait_pid = waitpid(-1, &wait_status, 0)) < 0) |
674 | if (wait_pid == -1) | 674 | if (errno != EINTR) |
675 | packet_disconnect("wait: %.100s", strerror(errno)); | 675 | packet_disconnect("wait: %.100s", strerror(errno)); |
676 | else if (wait_pid != pid) | 676 | if (wait_pid != pid) |
677 | error("Strange, wait returned pid %d, expected %d", | 677 | error("Strange, wait returned pid %d, expected %d", |
678 | wait_pid, pid); | 678 | wait_pid, pid); |
679 | 679 | ||
@@ -723,8 +723,10 @@ collect_children(void) | |||
723 | sigaddset(&nset, SIGCHLD); | 723 | sigaddset(&nset, SIGCHLD); |
724 | sigprocmask(SIG_BLOCK, &nset, &oset); | 724 | sigprocmask(SIG_BLOCK, &nset, &oset); |
725 | if (child_terminated) { | 725 | if (child_terminated) { |
726 | while ((pid = waitpid(-1, &status, WNOHANG)) > 0) | 726 | while ((pid = waitpid(-1, &status, WNOHANG)) > 0 || |
727 | session_close_by_pid(pid, status); | 727 | (pid < 0 && errno == EINTR)) |
728 | if (pid > 0) | ||
729 | session_close_by_pid(pid, status); | ||
728 | child_terminated = 0; | 730 | child_terminated = 0; |
729 | } | 731 | } |
730 | sigprocmask(SIG_SETMASK, &oset, NULL); | 732 | sigprocmask(SIG_SETMASK, &oset, NULL); |