sh: Fix crash when parsing '{ } &'.

MFC after:	1 week
This commit is contained in:
Jilles Tjoelker 2013-01-13 19:26:33 +00:00
parent 2c090c7168
commit 31d396587e
2 changed files with 9 additions and 2 deletions

View File

@ -240,9 +240,9 @@ list(int nlflag, int erflag)
n2 = andor();
tok = readtoken();
if (tok == TBACKGND) {
if (n2->type == NPIPE) {
if (n2 != NULL && n2->type == NPIPE) {
n2->npipe.backgnd = 1;
} else if (n2->type == NREDIR) {
} else if (n2 != NULL && n2->type == NREDIR) {
n2->type = NBACKGND;
} else {
n3 = (union node *)stalloc(sizeof (struct nredir));

View File

@ -0,0 +1,7 @@
# $FreeBSD$
# Unfortunately, some scripts depend on the extension of allowing an empty
# pair of braces.
{ } &
wait $!