sh: Fix crash when parsing '{ } &'.
MFC after: 1 week
This commit is contained in:
parent
1af5c5cc5f
commit
b479a582c3
@ -240,9 +240,9 @@ list(int nlflag, int erflag)
|
|||||||
n2 = andor();
|
n2 = andor();
|
||||||
tok = readtoken();
|
tok = readtoken();
|
||||||
if (tok == TBACKGND) {
|
if (tok == TBACKGND) {
|
||||||
if (n2->type == NPIPE) {
|
if (n2 != NULL && n2->type == NPIPE) {
|
||||||
n2->npipe.backgnd = 1;
|
n2->npipe.backgnd = 1;
|
||||||
} else if (n2->type == NREDIR) {
|
} else if (n2 != NULL && n2->type == NREDIR) {
|
||||||
n2->type = NBACKGND;
|
n2->type = NBACKGND;
|
||||||
} else {
|
} else {
|
||||||
n3 = (union node *)stalloc(sizeof (struct nredir));
|
n3 = (union node *)stalloc(sizeof (struct nredir));
|
||||||
|
7
tools/regression/bin/sh/parser/empty-braces1.0
Normal file
7
tools/regression/bin/sh/parser/empty-braces1.0
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
# Unfortunately, some scripts depend on the extension of allowing an empty
|
||||||
|
# pair of braces.
|
||||||
|
|
||||||
|
{ } &
|
||||||
|
wait $!
|
Loading…
x
Reference in New Issue
Block a user