mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
Avoid accessing the current job's process table in the child part of
forkshell() after it has been freed. This caused mysterious behaviour when anything but the first command in a pipeline tried to access the terminal when the `junk' malloc() option was enabled (which is the default).
This commit is contained in:
parent
e92a3d83fc
commit
4f8fa749f0
1 changed files with 5 additions and 3 deletions
|
|
@ -741,9 +741,6 @@ forkshell(struct job *jp, union node *n, int mode)
|
|||
TRACE(("Child shell %d\n", (int)getpid()));
|
||||
wasroot = rootshell;
|
||||
rootshell = 0;
|
||||
for (i = njobs, p = jobtab ; --i >= 0 ; p++)
|
||||
if (p->used)
|
||||
freejob(p);
|
||||
closescript();
|
||||
INTON;
|
||||
clear_traps();
|
||||
|
|
@ -785,6 +782,11 @@ forkshell(struct job *jp, union node *n, int mode)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
INTOFF;
|
||||
for (i = njobs, p = jobtab ; --i >= 0 ; p++)
|
||||
if (p->used)
|
||||
freejob(p);
|
||||
INTON;
|
||||
if (wasroot && iflag) {
|
||||
setsignal(SIGINT);
|
||||
setsignal(SIGQUIT);
|
||||
|
|
|
|||
Loading…
Reference in a new issue