]> andersk Git - openssh.git/commitdiff
- markus@cvs.openbsd.org 2002/03/30 18:51:15
authormouring <mouring>
Tue, 2 Apr 2002 20:48:19 +0000 (20:48 +0000)
committermouring <mouring>
Tue, 2 Apr 2002 20:48:19 +0000 (20:48 +0000)
     [monitor.c serverloop.c sftp-int.c sftp.c sshd.c]
     check waitpid for EINTR; based on patch from peter@ifm.liu.se

ChangeLog
monitor.c
serverloop.c
sftp-int.c
sftp.c
sshd.c

index b6cea574ccd9d7e73ecfa3454edbb56663dc8ce6..ba6c6fce89274765259c51c8aa68fd0e55d045fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,9 @@
    - stevesk@cvs.openbsd.org 2002/03/29 19:18:33
      [auth-rsa.c ssh-rsa.c ssh.h]
      make RSA modulus minimum #define; ok markus@
+   - markus@cvs.openbsd.org 2002/03/30 18:51:15
+     [monitor.c serverloop.c sftp-int.c sftp.c sshd.c]
+     check waitpid for EINTR; based on patch from peter@ifm.liu.se
 
 20020401
  - (stevesk) [monitor.c] PAM should work again; will *not* work with
index 7b4e53eb55103f01664161516c7f5f1e66f1d892..03f8dc74af7bf8ba7ec4b32ce77c746a9f114f22 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -25,7 +25,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: monitor.c,v 1.8 2002/03/27 17:45:42 mouring Exp $");
+RCSID("$OpenBSD: monitor.c,v 1.9 2002/03/30 18:51:15 markus Exp $");
 
 #include <openssl/dh.h>
 
@@ -1211,8 +1211,9 @@ mm_answer_term(int socket, Buffer *req)
        /* The child is terminating */
        session_destroy_all(&mm_session_close);
 
-       if (waitpid(monitor->m_pid, &status, 0) == -1)
-               exit(1);
+       while (waitpid(monitor->m_pid, &status, 0) == -1)
+               if (errno != EINTR)
+                       exit(1);
 
        res = WIFEXITED(status) ? WEXITSTATUS(status) : 1;
 
index cacf0ad429ddb2c53407a7ffcb37aa6b63d501e2..38b1cf7ba8074a92cd7f202e2a94ed3e2258a4b7 100644 (file)
@@ -35,7 +35,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: serverloop.c,v 1.100 2002/03/24 16:00:27 markus Exp $");
+RCSID("$OpenBSD: serverloop.c,v 1.101 2002/03/30 18:51:15 markus Exp $");
 
 #include "xmalloc.h"
 #include "packet.h"
@@ -670,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);
 
@@ -723,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);
index 46cbd4a129eb59cbf66cce1b39626537d0d50a41..5b1d3848e82895e96c4ff91ce28be7c8366eca2f 100644 (file)
@@ -26,7 +26,7 @@
 /* XXX: recursive operations */
 
 #include "includes.h"
-RCSID("$OpenBSD: sftp-int.c,v 1.45 2002/03/19 06:32:56 mpech Exp $");
+RCSID("$OpenBSD: sftp-int.c,v 1.46 2002/03/30 18:51:15 markus Exp $");
 
 #include "buffer.h"
 #include "xmalloc.h"
@@ -176,8 +176,9 @@ local_do_shell(const char *args)
                    strerror(errno));
                _exit(1);
        }
-       if (waitpid(pid, &status, 0) == -1)
-               fatal("Couldn't wait for child: %s", strerror(errno));
+       while (waitpid(pid, &status, 0) == -1)
+               if (errno != EINTR)
+                       fatal("Couldn't wait for child: %s", strerror(errno));
        if (!WIFEXITED(status))
                error("Shell exited abormally");
        else if (WEXITSTATUS(status))
diff --git a/sftp.c b/sftp.c
index f576ed3d50f061b06c39d2d78cf1b07d7677075f..e4086549cf75728993c8652aba9b4602c04049e6 100644 (file)
--- a/sftp.c
+++ b/sftp.c
@@ -24,7 +24,7 @@
 
 #include "includes.h"
 
-RCSID("$OpenBSD: sftp.c,v 1.27 2002/03/19 10:49:35 markus Exp $");
+RCSID("$OpenBSD: sftp.c,v 1.28 2002/03/30 18:51:15 markus Exp $");
 
 /* XXX: short-form remote directory listings (like 'ls -C') */
 
@@ -246,8 +246,10 @@ main(int argc, char **argv)
        if (infile != stdin)
                fclose(infile);
 
-       if (waitpid(sshpid, NULL, 0) == -1)
-               fatal("Couldn't wait for ssh process: %s", strerror(errno));
+       while (waitpid(sshpid, NULL, 0) == -1)
+               if (errno != EINTR)
+                       fatal("Couldn't wait for ssh process: %s",
+                           strerror(errno));
 
        exit(0);
 }
diff --git a/sshd.c b/sshd.c
index 541e9932ea8e3a46e90fcd4f55b1d880c7eb1448..2e21d3d4e4d0fc177446b53e5de5f3f44d8e2c6a 100644 (file)
--- a/sshd.c
+++ b/sshd.c
@@ -42,7 +42,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: sshd.c,v 1.238 2002/03/23 20:57:26 stevesk Exp $");
+RCSID("$OpenBSD: sshd.c,v 1.239 2002/03/30 18:51:15 markus Exp $");
 
 #include <openssl/dh.h>
 #include <openssl/bn.h>
@@ -276,10 +276,12 @@ sigterm_handler(int sig)
 static void
 main_sigchld_handler(int sig)
 {
+       pid_t pid;
        int save_errno = errno;
        int status;
 
-       while (waitpid(-1, &status, WNOHANG) > 0)
+       while ((pid = waitpid(-1, &status, WNOHANG)) > 0 ||
+           (pid < 0 && errno == EINTR))
                ;
 
        signal(SIGCHLD, main_sigchld_handler);
@@ -577,8 +579,9 @@ privsep_preauth(void)
                monitor_sync(monitor);
 
                /* Wait for the child's exit status */
-               waitpid(pid, &status, 0);
-
+               while (waitpid(pid, &status, 0) < 0)
+                       if (errno != EINTR)
+                               break;
                return (authctxt);
        } else {
                /* child */
This page took 0.064319 seconds and 5 git commands to generate.