From cf6b0f5663e798c8d4303697115230ac4469baca Mon Sep 17 00:00:00 2001
From: Peter Stephenson
Date: Mon, 29 Sep 2014 21:02:59 +0100
Subject: 33285: apply function definition redirections at execution
---
Src/hashtable.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
(limited to 'Src/hashtable.c')
diff --git a/Src/hashtable.c b/Src/hashtable.c
index ef187927b..7a430629d 100644
--- a/Src/hashtable.c
+++ b/Src/hashtable.c
@@ -887,6 +887,8 @@ freeshfuncnode(HashNode hn)
zsfree(shf->node.nam);
if (shf->funcdef)
freeeprog(shf->funcdef);
+ if (shf->redir)
+ freeeprog(shf->redir);
zsfree(shf->filename);
if (shf->sticky) {
if (shf->sticky->n_on_opts)
@@ -954,10 +956,19 @@ printshfuncnode(HashNode hn, int printflags)
printf(" \"$@\"");
}
}
- printf("\n}\n");
+ printf("\n}");
} else {
- printf(" () { }\n");
+ printf(" () { }");
}
+ if (f->redir) {
+ t = getpermtext(f->redir, NULL, 1);
+ if (t) {
+ zputs(t, stdout);
+ zsfree(t);
+ }
+ }
+
+ putchar('\n');
}
/**************************************/
--
cgit 1.4.1