Clean up INTOFF/INTON usage a little -- none of fork{shell,parent,child}()

screw with them now, only their callers.
This commit is contained in:
mycroft 2002-09-27 21:32:24 +00:00
parent 7c22835649
commit d84d36165d
3 changed files with 13 additions and 16 deletions

View File

@ -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 <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include "shell.h"
#include "main.h"

View File

@ -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)

View File

@ -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)