aboutsummaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin.c b/builtin.c
index 784c8190..c4d3d3a1 100644
--- a/builtin.c
+++ b/builtin.c
@@ -2208,8 +2208,12 @@ do_print_rec(int nargs, int redirtype)
if (redirtype != 0) {
redir_exp = TOP();
rp = redirect(redir_exp, redirtype, & errflg);
- if (rp != NULL)
+ if (rp != NULL) {
+ if ((rp->flag & RED_TWOWAY) != 0 && rp->output.fp == NULL) {
+ fatal(_("print: attempt to write to closed write end of two-way pipe"));
+ }
fp = rp->output.fp;
+ }
DEREF(redir_exp);
decr_sp();
} else