From d84d36165d0198b19ad7de0a7ba15c244c13bdd1 Mon Sep 17 00:00:00 2001 From: mycroft Date: Fri, 27 Sep 2002 21:32:24 +0000 Subject: [PATCH] Clean up INTOFF/INTON usage a little -- none of fork{shell,parent,child}() screw with them now, only their callers. --- bin/sh/error.c | 5 +++-- bin/sh/eval.c | 15 ++++++++------- bin/sh/jobs.c | 9 ++------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/bin/sh/error.c b/bin/sh/error.c index 4322e1eba66e..1212772a33f6 100644 --- a/bin/sh/error.c +++ b/bin/sh/error.c @@ -1,4 +1,4 @@ -/* $NetBSD: error.c,v 1.26 2002/09/27 16:56:15 christos Exp $ */ +/* $NetBSD: error.c,v 1.27 2002/09/27 21:32:24 mycroft Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)error.c 8.2 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: error.c,v 1.26 2002/09/27 16:56:15 christos Exp $"); +__RCSID("$NetBSD: error.c,v 1.27 2002/09/27 21:32:24 mycroft Exp $"); #endif #endif /* not lint */ @@ -53,6 +53,7 @@ __RCSID("$NetBSD: error.c,v 1.26 2002/09/27 16:56:15 christos Exp $"); #include #include #include +#include #include "shell.h" #include "main.h" diff --git a/bin/sh/eval.c b/bin/sh/eval.c index 042c6250f700..a90c30c4bbbe 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -1,4 +1,4 @@ -/* $NetBSD: eval.c,v 1.62 2002/09/27 20:24:36 christos Exp $ */ +/* $NetBSD: eval.c,v 1.63 2002/09/27 21:32:25 mycroft Exp $ */ /*- * Copyright (c) 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; #else -__RCSID("$NetBSD: eval.c,v 1.62 2002/09/27 20:24:36 christos Exp $"); +__RCSID("$NetBSD: eval.c,v 1.63 2002/09/27 21:32:25 mycroft Exp $"); #endif #endif /* not lint */ @@ -410,18 +410,18 @@ evalsubshell(n, flags) int backgnd = (n->type == NBACKGND); expredir(n->nredir.redirect); + INTOFF; jp = makejob(n, 1); if (forkshell(jp, n, backgnd) == 0) { + INTON; if (backgnd) flags &=~ EV_TESTED; redirect(n->nredir.redirect, 0); evaltree(n->nredir.n, flags | EV_EXIT); /* never returns */ } - if (! backgnd) { - INTOFF; + if (! backgnd) exitstatus = waitforjob(jp); - INTON; - } + INTON; } @@ -565,6 +565,7 @@ evalbackcmd(n, result) #endif { exitstatus = 0; + INTOFF; if (pipe(pip) < 0) error("Pipe call failed"); jp = makejob(n, 1); @@ -582,6 +583,7 @@ evalbackcmd(n, result) close(pip[1]); result->fd = pip[0]; result->jp = jp; + INTON; } out: popstackmark(&smark); @@ -749,7 +751,6 @@ evalcommand(cmd, flags, backcmd) if (cmdentry.cmdtype == CMDNORMAL) { pid_t pid; - INTOFF; savelocalvars = localvars; localvars = NULL; for (sp = varlist.list ; sp ; sp = sp->next) diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c index 3c11ca2c40f2..0cda0a2dcaf2 100644 --- a/bin/sh/jobs.c +++ b/bin/sh/jobs.c @@ -1,4 +1,4 @@ -/* $NetBSD: jobs.c,v 1.48 2002/09/27 21:04:08 christos Exp $ */ +/* $NetBSD: jobs.c,v 1.49 2002/09/27 21:32:25 mycroft Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: jobs.c,v 1.48 2002/09/27 21:04:08 christos Exp $"); +__RCSID("$NetBSD: jobs.c,v 1.49 2002/09/27 21:32:25 mycroft Exp $"); #endif #endif /* not lint */ @@ -659,7 +659,6 @@ forkshell(jp, n, mode) int pid; TRACE(("forkshell(%%%d, %p, %d) called\n", jp - jobtab, n, mode)); - INTOFF; switch ((pid = fork())) { case -1: TRACE(("Fork failed, errno=%d", errno)); @@ -704,7 +703,6 @@ forkparent(jp, n, mode, pid) if (iflag && rootshell && n) ps->cmd = commandtext(n); } - INTON; TRACE(("In parent shell: child = %d\n", pid)); return pid; } @@ -732,9 +730,6 @@ forkchild(jp, n, mode, vforked) freejob(p); } closescript(vforked); - if (!vforked) { - INTON; - } clear_traps(vforked); #if JOBS if (!vforked)