Author: jilles
Date: Sun Jan 13 19:26:33 2013
New Revision: 245382
URL: http://svnweb.freebsd.org/changeset/base/245382

Log:
  sh: Fix crash when parsing '{ } &'.
  
  MFC after:    1 week

Added:
  head/tools/regression/bin/sh/parser/empty-braces1.0   (contents, props 
changed)
Modified:
  head/bin/sh/parser.c

Modified: head/bin/sh/parser.c
==============================================================================
--- head/bin/sh/parser.c        Sun Jan 13 19:19:40 2013        (r245381)
+++ head/bin/sh/parser.c        Sun Jan 13 19:26:33 2013        (r245382)
@@ -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));

Added: head/tools/regression/bin/sh/parser/empty-braces1.0
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/parser/empty-braces1.0 Sun Jan 13 19:26:33 
2013        (r245382)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+# Unfortunately, some scripts depend on the extension of allowing an empty
+# pair of braces.
+
+{ } &
+wait $!
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to