diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2002-06-23 14:01:54 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2002-06-23 14:01:54 +0000 |
commit | 545d5eca429a5967b3300cb527d49cae8184e79f (patch) | |
tree | 07d2725bfa4789fc97a184f8beffb275c8c7bdcb /crypto/openssh/serverloop.c | |
parent | 556a3fb01ef9b6221d190bb62371a2c28ffd4757 (diff) | |
download | src-545d5eca429a5967b3300cb527d49cae8184e79f.tar.gz src-545d5eca429a5967b3300cb527d49cae8184e79f.zip |
Vendor import of OpenSSH 3.3.
Notes
Notes:
svn path=/vendor-crypto/openssh/dist/; revision=98675
Diffstat (limited to 'crypto/openssh/serverloop.c')
-rw-r--r-- | crypto/openssh/serverloop.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/crypto/openssh/serverloop.c b/crypto/openssh/serverloop.c index 5dd8a715ca95..b72c921d98b6 100644 --- a/crypto/openssh/serverloop.c +++ b/crypto/openssh/serverloop.c @@ -35,7 +35,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: serverloop.c,v 1.98 2002/02/06 14:55:16 markus Exp $"); +RCSID("$OpenBSD: serverloop.c,v 1.102 2002/06/11 05:46:20 mpech Exp $"); #include "xmalloc.h" #include "packet.h" @@ -318,9 +318,6 @@ wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp, tv.tv_usec = 1000 * (max_time_milliseconds % 1000); tvp = &tv; } - if (tvp!=NULL) - debug3("tvp!=NULL kid %d mili %d", (int) child_terminated, - max_time_milliseconds); /* Wait for something to happen, or the timeout to expire. */ ret = select((*maxfdp)+1, *readsetp, *writesetp, NULL, tvp); @@ -673,12 +670,12 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg) /* We no longer want our SIGCHLD handler to be called. */ signal(SIGCHLD, SIG_DFL); - wait_pid = waitpid(-1, &wait_status, 0); - if (wait_pid == -1) - packet_disconnect("wait: %.100s", strerror(errno)); - else if (wait_pid != pid) - error("Strange, wait returned pid %d, expected %d", - wait_pid, pid); + while ((wait_pid = waitpid(-1, &wait_status, 0)) < 0) + if (errno != EINTR) + packet_disconnect("wait: %.100s", strerror(errno)); + if (wait_pid != pid) + error("Strange, wait returned pid %ld, expected %ld", + (long)wait_pid, (long)pid); /* Check if it exited normally. */ if (WIFEXITED(wait_status)) { @@ -726,8 +723,10 @@ collect_children(void) sigaddset(&nset, SIGCHLD); sigprocmask(SIG_BLOCK, &nset, &oset); if (child_terminated) { - while ((pid = waitpid(-1, &status, WNOHANG)) > 0) - session_close_by_pid(pid, status); + while ((pid = waitpid(-1, &status, WNOHANG)) > 0 || + (pid < 0 && errno == EINTR)) + if (pid > 0) + session_close_by_pid(pid, status); child_terminated = 0; } sigprocmask(SIG_SETMASK, &oset, NULL); @@ -784,7 +783,7 @@ server_loop2(Authctxt *authctxt) channel_free_all(); /* free remaining sessions, e.g. remove wtmp entries */ - session_destroy_all(); + session_destroy_all(NULL); } static void |