From candy@fct.kgc.co.jp  Thu Sep 28 00:45:37 1995
Received: from mail0.iij.ad.jp (root@mail0.iij.ad.jp [192.244.176.61])
          by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id AAA06680
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 28 Sep 1995 00:45:30 -0700
Received: from uucp0.iij.ad.jp (uucp0.iij.ad.jp [192.244.176.51]) by mail0.iij.ad.jp (8.6.12+2.4W/3.3W9-MAIL) with ESMTP id QAA22213 for <FreeBSD-gnats-submit@freebsd.org>; Thu, 28 Sep 1995 16:45:18 +0900
Received: (from uucp@localhost) by uucp0.iij.ad.jp (8.6.12+2.4W/3.3W9-UUCP) with UUCP id QAA12883 for FreeBSD-gnats-submit@freebsd.org; Thu, 28 Sep 1995 16:45:17 +0900
Received: from xxx.fct.kgc.co.jp by fender.fct.kgc.co.jp (8.6.12+2.4W/3.4W:95071117) id QAA23568; Thu, 28 Sep 1995 16:31:32 +0900
Received: by xxx.fct.kgc.co.jp (8.6.11/3.3W8:95062916) id QAA03741; Thu, 28 Sep 1995 16:31:30 +0900
Message-Id: <199509280731.QAA03741@xxx.fct.kgc.co.jp>
Date: Thu, 28 Sep 1995 16:31:30 +0900
From: Toshihiro Kanda <candy@fct.kgc.co.jp>
Reply-To: candy@fct.kgc.co.jp
To: FreeBSD-gnats-submit@freebsd.org
Subject: crontab(1): `crontab -e' exits on SIGINT
X-Send-Pr-Version: 3.2

>Number:         751
>Category:       bin
>Synopsis:       crontab(1): `crontab -e' exits on SIGINT
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 28 00:50:01 PDT 1995
>Closed-Date:    Tue Apr 9 13:28:41 PDT 1996
>Last-Modified:  Tue Apr  9 13:29:39 PDT 1996
>Originator:     Toshihiro Kanda
>Release:        FreeBSD 2.0.5-RELEASE i386
>Organization:
candy@fct.kgc.co.jp (Toshihiro Kanda)
>Environment:

$ uname -rms
FreeBSD 2.0.5-RELEASE i386

>Description:

When `crontab -e' invokes vi, ctl-C kills crontab but vi.  Then
vi is left alone and things go strange.

>How-To-Repeat:

Assuming /bin/sh syntax oriented shell...
$ EDITOR=/usr/bin/vi crontab -e
then type ctl-C.

>Fix:

Crontab exec's ``/bin/sh -c /usr/bin/vi tmp'', and sh seems exit
by SIGINT.  I wonder if crontab exec's vi directly.  At least it
seems to fix this problem.


*** crontab.c.orig	Tue May 30 12:47:04 1995
--- crontab.c	Thu Sep 28 16:08:25 1995
***************
*** 404,411 ****
--- 404,414 ----
  				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,421 ****
--- 418,433 ----
  	}
  
  	/* 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);
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: scrappy 
State-Changed-When: Tue Apr 9 13:28:41 PDT 1996 
State-Changed-Why:  
patched applied, tested and commited 
>Unformatted:
