summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-04-12 09:39:59 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-04-12 09:39:59 +0000
commitaa3f529037d19bac2d042776273845bc0ebe5eb3 (patch)
tree664530292993ca4fd97e465b81c5b80f46f4ed6e /usr.sbin
parentcf19accdd30bc78abd1ddbf624965e00054a2e6b (diff)
support SIGSTOP in editor, I cannot believe this has always been busted!
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/cron/crontab.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/usr.sbin/cron/crontab.c b/usr.sbin/cron/crontab.c
index 8e179dce84a..31c5814620a 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.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
@@ -424,23 +424,26 @@ edit_cmd() {
}
/* 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");