diff options
-rw-r--r-- | bin/sh/parser.c | 6 | ||||
-rw-r--r-- | tools/regression/bin/sh/errors/bad-keyword1.0 | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c index 0540dd6..fa670f1 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -220,7 +220,7 @@ parsecmd(int interact) if (t == TNL) return NULL; tokpushback++; - return list(1, 0); + return list(1, 1); } @@ -231,7 +231,7 @@ list(int nlflag, int erflag) int tok; checkkwd = 2; - if (nlflag == 0 && tokendlist[peektoken()]) + if (!nlflag && !erflag && tokendlist[peektoken()]) return NULL; n1 = NULL; for (;;) { @@ -277,7 +277,7 @@ list(int nlflag, int erflag) tokpushback++; } checkkwd = 2; - if (tokendlist[peektoken()]) + if (!nlflag && !erflag && tokendlist[peektoken()]) return n1; break; case TEOF: diff --git a/tools/regression/bin/sh/errors/bad-keyword1.0 b/tools/regression/bin/sh/errors/bad-keyword1.0 new file mode 100644 index 0000000..1abc158 --- /dev/null +++ b/tools/regression/bin/sh/errors/bad-keyword1.0 @@ -0,0 +1,4 @@ +# $FreeBSD$ + +echo ':; fi' | sh -n 2>/dev/null && exit 1 +exit 0 |