summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/sh/parser.c4
-rw-r--r--tools/regression/bin/sh/parser/empty-braces1.07
2 files changed, 9 insertions, 2 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index a19ca31..665b53f 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -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));
diff --git a/tools/regression/bin/sh/parser/empty-braces1.0 b/tools/regression/bin/sh/parser/empty-braces1.0
new file mode 100644
index 0000000..5ab443c
--- /dev/null
+++ b/tools/regression/bin/sh/parser/empty-braces1.0
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+# Unfortunately, some scripts depend on the extension of allowing an empty
+# pair of braces.
+
+{ } &
+wait $!
OpenPOWER on IntegriCloud