diff options
author | Jilles Tjoelker <jilles@FreeBSD.org> | 2009-08-28 22:41:25 +0000 |
---|---|---|
committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2009-08-28 22:41:25 +0000 |
commit | e16947f83d758544093c5709d58be72bd4d25522 (patch) | |
tree | 7a8084b831c46519ff07655affc5c604f115d66a /bin/sh/mknodes.c | |
parent | a99fcfd4ca91f6fc8cd17f665933648559172adf (diff) | |
download | src-e16947f83d758544093c5709d58be72bd4d25522.tar.gz src-e16947f83d758544093c5709d58be72bd4d25522.zip |
sh: Fix crash with empty functions (f() { }) introduced in r196483
Empty pairs of braces are represented by a NULL node pointer, just like
empty lines at the top level.
Support for empty pairs of braces may be removed later. They make the code
more complex, have inconsistent behaviour (may or may not change $?), are
not specified by POSIX and are not allowed by some other shells like bash,
dash and ksh93.
Reported by: kan
Notes
Notes:
svn path=/head/; revision=196634
Diffstat (limited to 'bin/sh/mknodes.c')
-rw-r--r-- | bin/sh/mknodes.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/bin/sh/mknodes.c b/bin/sh/mknodes.c index 904f9f4092ac..1a177f89531b 100644 --- a/bin/sh/mknodes.c +++ b/bin/sh/mknodes.c @@ -248,11 +248,9 @@ output(char *file) fputs("\tstruct nodelist *next;\n", hfile); fputs("\tunion node *n;\n", hfile); fputs("};\n\n\n", hfile); - fputs("struct funcdef {\n", hfile); - fputs("\tunsigned int refcount;\n", hfile); - fputs("\tunion node n;\n", hfile); - fputs("};\n\n\n", hfile); + fputs("struct funcdef;\n", hfile); fputs("struct funcdef *copyfunc(union node *);\n", hfile); + fputs("union node *getfuncnode(struct funcdef *);\n", hfile); fputs("void reffunc(struct funcdef *);\n", hfile); fputs("void unreffunc(struct funcdef *);\n", hfile); |