diff options
author | scrappy <scrappy@FreeBSD.org> | 1996-04-09 20:28:16 +0000 |
---|---|---|
committer | scrappy <scrappy@FreeBSD.org> | 1996-04-09 20:28:16 +0000 |
commit | 35b5c03864fbddefc1c97b618756450e0f35a51f (patch) | |
tree | 27fdbc2da475edfad82179afd9d8e6914dbe3187 /usr.sbin | |
parent | 48b2e5079be3666812e6ad8e1fdc9c2bf41b6253 (diff) | |
download | FreeBSD-src-35b5c03864fbddefc1c97b618756450e0f35a51f.zip FreeBSD-src-35b5c03864fbddefc1c97b618756450e0f35a51f.tar.gz |
Quick patch to fix a bug where issuing ctl-c while in crontab -e
leaves editor running in background (PR: bin/751)
Submitted by: candy@fct.kgc.co.jp (Toshihiro Kanda)
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/cron/crontab/crontab.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/usr.sbin/cron/crontab/crontab.c b/usr.sbin/cron/crontab/crontab.c index 0af18c3..676c903 100644 --- a/usr.sbin/cron/crontab/crontab.c +++ b/usr.sbin/cron/crontab/crontab.c @@ -17,7 +17,7 @@ */ #if !defined(lint) && !defined(LINT) -static char rcsid[] = "$Id: crontab.c,v 1.2 1994/12/21 11:06:08 ache Exp $"; +static char rcsid[] = "$Id: crontab.c,v 1.3 1995/05/30 03:47:04 rgrimes Exp $"; #endif /* crontab - install and manage per-user crontab files @@ -404,8 +404,7 @@ edit_cmd() { ProgramName); exit(ERROR_EXIT); } - sprintf(q, "%s %s", editor, Filename); - execlp(_PATH_BSHELL, _PATH_BSHELL, "-c", q, NULL); + execlp(editor, editor, Filename, NULL); perror(editor); exit(ERROR_EXIT); /*NOTREACHED*/ @@ -415,7 +414,16 @@ edit_cmd() { } /* parent */ + { + void (*f[4])(); + f[0] = signal(SIGHUP, SIG_IGN); + f[1] = signal(SIGINT, SIG_IGN); + f[2] = signal(SIGTERM, SIG_IGN); xpid = wait(&waiter); + signal(SIGHUP, f[0]); + signal(SIGINT, f[1]); + signal(SIGTERM, f[2]); + } if (xpid != pid) { fprintf(stderr, "%s: wrong PID (%d != %d) from \"%s\"\n", ProgramName, xpid, pid, editor); |