From: millert Date: Sat, 12 Apr 1997 17:50:17 +0000 (+0000) Subject: waitpid() can return -1 -- give a useful error message if it does. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1b21650e40e710faf841bf150ab2f99255bd050e;p=openbsd waitpid() can return -1 -- give a useful error message if it does. --- 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;