From 1b21650e40e710faf841bf150ab2f99255bd050e Mon Sep 17 00:00:00 2001 From: millert Date: Sat, 12 Apr 1997 17:50:17 +0000 Subject: [PATCH] waitpid() can return -1 -- give a useful error message if it does. --- usr.sbin/cron/crontab.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/usr.sbin/cron/crontab.c b/usr.sbin/cron/crontab.c index 10c946bcb7e..901b43902f9 100644 --- a/usr.sbin/cron/crontab.c +++ b/usr.sbin/cron/crontab.c @@ -16,7 +16,7 @@ */ #if !defined(lint) && !defined(LINT) -static char rcsid[] = "$Id: crontab.c,v 1.10 1997/04/12 14:51:22 deraadt Exp $"; +static char rcsid[] = "$Id: crontab.c,v 1.11 1997/04/12 17:50:17 millert Exp $"; #endif /* crontab - install and manage per-user crontab files @@ -430,7 +430,10 @@ edit_cmd() { /* parent */ while (1) { xpid = waitpid(pid, &waiter, WUNTRACED); - if (xpid != pid) { + if (xpid == -1) { + fprintf(stderr, "%s: waitpid() failed waiting for PID %d from \"%s\": %s\n", + ProgramName, pid, editor, strerror(errno)); + } else if (xpid != pid) { fprintf(stderr, "%s: wrong PID (%d != %d) from \"%s\"\n", ProgramName, xpid, pid, editor); goto fatal; -- 2.20.1