]> andersk Git - gssapi-openssh.git/blobdiff - openssh/serverloop.c
Import of OpenSSH 3.2.2p1
[gssapi-openssh.git] / openssh / serverloop.c
index 46b12ee3d3d73cde2992875d026bb0c865e8e648..38b1cf7ba8074a92cd7f202e2a94ed3e2258a4b7 100644 (file)
@@ -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.101 2002/03/30 18:51:15 markus 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,10 +670,10 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
        /* We no longer want our SIGCHLD handler to be called. */
        mysignal(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)
+       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 %d, expected %d",
                    wait_pid, pid);
 
@@ -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
This page took 0.050021 seconds and 4 git commands to generate.