Close PR# 1206. sh(1) now ignores SIGINT and SIGQUIT
when a child is forked and the -c commandline switch has been specified. Reviewed by: joerg
This commit is contained in:
parent
eb66ca7b64
commit
b9ab560398
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19084
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: eval.c,v 1.5 1996/09/01 10:19:57 peter Exp $
|
||||
* $Id: eval.c,v 1.6 1996/10/06 15:17:19 steve Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -210,7 +210,6 @@ evaltree(n, flags)
|
||||
case NAND:
|
||||
evaltree(n->nbinary.ch1, EV_TESTED);
|
||||
if (evalskip || exitstatus != 0) {
|
||||
/* don't bomb out on "set -e; false && true" */
|
||||
flags |= EV_TESTED;
|
||||
goto out;
|
||||
}
|
||||
@ -855,7 +854,24 @@ evalcommand(cmd, flags, backcmd)
|
||||
parent: /* parent process gets here (if we forked) */
|
||||
if (mode == 0) { /* argument to fork */
|
||||
INTOFF;
|
||||
exitstatus = waitforjob(jp);
|
||||
if (minusc) {
|
||||
struct sigaction iact, qact, oiact, oqact;
|
||||
|
||||
(void)sigaction(SIGINT, (struct sigaction *)NULL, &oiact);
|
||||
(void)sigaction(SIGQUIT, (struct sigaction *)NULL, &oqact);
|
||||
|
||||
iact = oiact;
|
||||
qact = oqact;
|
||||
|
||||
qact.sa_handler = iact.sa_handler = SIG_IGN;
|
||||
|
||||
(void)sigaction(SIGINT, &iact, (struct sigaction *)NULL);
|
||||
(void)sigaction(SIGQUIT, &qact, (struct sigaction *)NULL);
|
||||
exitstatus = waitforjob(jp);
|
||||
(void)sigaction(SIGINT, &oiact, (struct sigaction *)NULL);
|
||||
(void)sigaction(SIGQUIT, &oqact, (struct sigaction *)NULL);
|
||||
} else
|
||||
exitstatus = waitforjob(jp);
|
||||
INTON;
|
||||
} else if (mode == 2) {
|
||||
backcmd->fd = pip[0];
|
||||
|
Loading…
Reference in New Issue
Block a user