Author: jilles
Date: Sun Jan 20 14:22:21 2013
New Revision: 245690
URL: http://svnweb.freebsd.org/changeset/base/245690

Log:
  MFC r245382: sh: Fix crash when parsing '{ } &'.

Added:
  stable/9/tools/regression/bin/sh/parser/empty-braces1.0
     - copied unchanged from r245382, 
head/tools/regression/bin/sh/parser/empty-braces1.0
Modified:
  stable/9/bin/sh/parser.c
Directory Properties:
  stable/9/bin/sh/   (props changed)
  stable/9/tools/regression/bin/sh/   (props changed)

Modified: stable/9/bin/sh/parser.c
==============================================================================
--- stable/9/bin/sh/parser.c    Sun Jan 20 12:44:50 2013        (r245689)
+++ stable/9/bin/sh/parser.c    Sun Jan 20 14:22:21 2013        (r245690)
@@ -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));

Copied: stable/9/tools/regression/bin/sh/parser/empty-braces1.0 (from r245382, 
head/tools/regression/bin/sh/parser/empty-braces1.0)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/9/tools/regression/bin/sh/parser/empty-braces1.0     Sun Jan 20 
14:22:21 2013        (r245690, copy of r245382, 
head/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 $!
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to