From 47fd8112b5ad0e83d895e5be9342b70832ea3075 Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Tue, 2 Apr 2002 20:48:19 +0000 Subject: - 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 --- sshd.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sshd.c') diff --git a/sshd.c b/sshd.c index 541e9932e..2e21d3d4e 100644 --- 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 #include @@ -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 */ -- cgit v1.2.3