From 124c3594cb65748ce858dcc55eadd7c831cee041 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 13 Mar 2016 20:21:00 +0200 Subject: Initial fix for use of closed end of two-way connection. --- io.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'io.c') diff --git a/io.c b/io.c index d4435684..de753973 100644 --- a/io.c +++ b/io.c @@ -2473,6 +2473,8 @@ do_getline_redir(int into_variable, enum redirval redirtype) update_ERRNO_int(redir_error); } return make_number((AWKNUM) -1.0); + } else if ((rp->flag & RED_TWOWAY) != 0 && rp->iop == NULL) { + fatal(_("getline: attempt to read from closed read end of two-way pipe")); } iop = rp->iop; if (iop == NULL) /* end of input */ -- cgit v1.2.3 From 1b5d1b8870cb0ac1c4b99f6cf67e3277427df864 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 4 Apr 2016 23:11:19 +0300 Subject: Add warning for fflush of closed write end on 2-way pipe. --- io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'io.c') diff --git a/io.c b/io.c index de753973..fe1261aa 100644 --- a/io.c +++ b/io.c @@ -1328,7 +1328,7 @@ flush_io() warning(_("error writing standard error (%s)"), strerror(errno)); status++; } - for (rp = red_head; rp != NULL; rp = rp->next) + for (rp = red_head; rp != NULL; rp = rp->next) { /* flush both files and pipes, what the heck */ if ((rp->flag & RED_WRITE) != 0 && rp->output.fp != NULL) { if (rp->output.gawk_fflush(rp->output.fp, rp->output.opaque)) { @@ -1344,6 +1344,7 @@ flush_io() status++; } } + } if (status != 0) status = -1; /* canonicalize it */ return status; -- cgit v1.2.3