aboutsummaryrefslogtreecommitdiff
path: root/bin/sh/exec.c
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2009-08-28 22:41:25 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2009-08-28 22:41:25 +0000
commite16947f83d758544093c5709d58be72bd4d25522 (patch)
tree7a8084b831c46519ff07655affc5c604f115d66a /bin/sh/exec.c
parenta99fcfd4ca91f6fc8cd17f665933648559172adf (diff)
downloadsrc-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/exec.c')
-rw-r--r--bin/sh/exec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/sh/exec.c b/bin/sh/exec.c
index 639a23cf78f3..810782166a9f 100644
--- a/bin/sh/exec.c
+++ b/bin/sh/exec.c
@@ -286,7 +286,7 @@ printentry(struct tblentry *cmdp, int verbose)
out1fmt("function %s", cmdp->cmdname);
if (verbose) {
INTOFF;
- name = commandtext(&cmdp->param.func->n);
+ name = commandtext(getfuncnode(cmdp->param.func));
out1c(' ');
out1str(name);
ckfree(name);