Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Feb 1998 20:43:20 +0100
From:      Martin Cracauer <cracauer@cons.org>
To:        cvs-commiters@FreeBSD.ORG
Cc:        cracauer@cons.org
Subject:   Re: Please review fix for /bin/sh SIGQUIT/SIGINT problem
Message-ID:  <19980205204320.31887@cons.org>
In-Reply-To: <19980205202824.51394@cons.org>; from Martin Cracauer on Thu, Feb 05, 1998 at 08:28:24PM %2B0100
References:  <19980205202824.51394@cons.org>

next in thread | previous in thread | raw e-mail | index | archive | help
I found another case that needs to be taken into account.

The fix appended also works right for

#/bin/sh
somebackgroundjobs &
while `true` ; do foo=1 ; done


Martin


diff -r -c sh.original/jobs.c sh/jobs.c
*** sh.original/jobs.c	Mon Mar 10 10:53:43 1997
--- sh/jobs.c	Thu Feb  5 20:37:11 1998
***************
*** 553,558 ****
--- 553,562 ----
  	TRACE(("forkshell(%%%d, 0x%lx, %d) called\n", jp - jobtab, (long)n,
  	    mode));
  	INTOFF;
+ 	if (mode == FORK_FG) {
+ 	  signal(SIGQUIT,SIG_IGN);
+ 	  signal(SIGINT,SIG_IGN);
+ 	}
  	pid = fork();
  	if (pid == -1) {
  		TRACE(("Fork failed, errno=%d\n", errno));
***************
*** 565,570 ****
--- 569,576 ----
  		int i;
  
  		TRACE(("Child shell %d\n", getpid()));
+ 		signal(SIGQUIT,SIG_DFL);
+ 		signal(SIGINT,SIG_DFL);
  		wasroot = rootshell;
  		rootshell = 0;
  		for (i = njobs, p = jobtab ; --i >= 0 ; p++)
***************
*** 674,679 ****
--- 680,688 ----
  	while (jp->state == 0) {
  		dowait(1, jp);
  	}
+ 	signal(SIGQUIT,SIG_DFL);
+ 	signal(SIGINT,SIG_DFL);
+ 
  #if JOBS
  	if (jp->jobctl) {
  		if (ioctl(2, TIOCSPGRP, (char *)&mypgrp) < 0)

-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer
  cracauer@wavehh.hanse.de (batched, preferred for large mails)
  Tel.: (daytime) +4940 41478712 Fax.: (daytime) +4940 41478715
  Tel.: (private) +4940 5221829 Fax.: (private) +4940 5228536
  Paper: (private) Waldstrasse 200, 22846 Norderstedt, Germany



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980205204320.31887>