*/
#if !defined(lint) && !defined(LINT)
-static char rcsid[] = "$Id: crontab.c,v 1.8 1996/12/25 19:08:09 mickey Exp $";
+static char rcsid[] = "$Id: crontab.c,v 1.9 1997/04/12 09:39:58 deraadt Exp $";
#endif
/* crontab - install and manage per-user crontab files
}
/* parent */
- xpid = wait(&waiter);
- if (xpid != pid) {
- fprintf(stderr, "%s: wrong PID (%d != %d) from \"%s\"\n",
- ProgramName, xpid, pid, editor);
- goto fatal;
- }
- if (WIFEXITED(waiter) && WEXITSTATUS(waiter)) {
- fprintf(stderr, "%s: \"%s\" exited with status %d\n",
- ProgramName, editor, WEXITSTATUS(waiter));
- goto fatal;
- }
- if (WIFSIGNALED(waiter)) {
- fprintf(stderr,
- "%s: \"%s\" killed; signal %d (%score dumped)\n",
- ProgramName, editor, WTERMSIG(waiter),
- WCOREDUMP(waiter) ?"" :"no ");
- goto fatal;
+ while (1) {
+ xpid = waitpid(pid, &waiter, WUNTRACED);
+ if (xpid != pid) {
+ fprintf(stderr, "%s: wrong PID (%d != %d) from \"%s\"\n",
+ ProgramName, xpid, pid, editor);
+ goto fatal;
+ } else if (WIFSTOPPED(waiter)) {
+ raise(WSTOPSIG(waiter));
+ } else if (WIFEXITED(waiter) && WEXITSTATUS(waiter)) {
+ fprintf(stderr, "%s: \"%s\" exited with status %d\n",
+ ProgramName, editor, WEXITSTATUS(waiter));
+ goto fatal;
+ } else if (WIFSIGNALED(waiter)) {
+ fprintf(stderr,
+ "%s: \"%s\" killed; signal %d (%score dumped)\n",
+ ProgramName, editor, WTERMSIG(waiter),
+ WCOREDUMP(waiter) ?"" :"no ");
+ goto fatal;
+ } else
+ break;
}
if (fstat(t, &statbuf) < 0) {
perror("fstat");