From ff77ca8965a479d35aacd077a89a489723bb2b65 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sat, 11 Aug 2001 20:47:15 +0000 Subject: If waitpid() returns -1, check for EINTR --- usr.sbin/cron/cron.c | 6 ++++-- usr.sbin/cron/crontab.c | 9 +++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/usr.sbin/cron/cron.c b/usr.sbin/cron/cron.c index 3772b4574a4..a2ce0eba63a 100644 --- a/usr.sbin/cron/cron.c +++ b/usr.sbin/cron/cron.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cron.c,v 1.14 2001/07/13 03:28:48 millert Exp $ */ +/* $OpenBSD: cron.c,v 1.15 2001/08/11 20:47:14 millert Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * All rights reserved */ @@ -21,7 +21,7 @@ */ #if !defined(lint) && !defined(LINT) -static char rcsid[] = "$OpenBSD: cron.c,v 1.14 2001/07/13 03:28:48 millert Exp $"; +static char rcsid[] = "$OpenBSD: cron.c,v 1.15 2001/08/11 20:47:14 millert Exp $"; #endif #define MAIN_PROGRAM @@ -368,6 +368,8 @@ sigchld_reaper() { pid = waitpid(-1, &waiter, WNOHANG); switch (pid) { case -1: + if (errno == EINTR) + continue; Debug(DPROC, ("[%ld] sigchld...no children\n", (long)getpid())) diff --git a/usr.sbin/cron/crontab.c b/usr.sbin/cron/crontab.c index e36ee83826a..5fb78c5c75e 100644 --- a/usr.sbin/cron/crontab.c +++ b/usr.sbin/cron/crontab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crontab.c,v 1.20 2001/07/09 07:05:00 deraadt Exp $ */ +/* $OpenBSD: crontab.c,v 1.21 2001/08/11 20:47:14 millert Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * All rights reserved */ @@ -21,7 +21,7 @@ */ #if !defined(lint) && !defined(LINT) -static char rcsid[] = "$OpenBSD: crontab.c,v 1.20 2001/07/09 07:05:00 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: crontab.c,v 1.21 2001/08/11 20:47:14 millert Exp $"; #endif /* crontab - install and manage per-user crontab files @@ -432,8 +432,9 @@ edit_cmd(void) { for (;;) { xpid = waitpid(pid, &waiter, WUNTRACED); if (xpid == -1) { - fprintf(stderr, "%s: waitpid() failed waiting for PID %ld from \"%s\": %s\n", - ProgramName, (long)pid, editor, strerror(errno)); + if (errno != EINTR) + fprintf(stderr, "%s: waitpid() failed waiting for PID %ld from \"%s\": %s\n", + ProgramName, (long)pid, editor, strerror(errno)); } else if (xpid != pid) { fprintf(stderr, "%s: wrong PID (%ld != %ld) from \"%s\"\n", ProgramName, (long)xpid, (long)pid, editor); -- cgit v1.2.3