aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2016-04-06 06:00:28 +0300
committerArnold D. Robbins <arnold@skeeve.com>2016-04-06 06:00:28 +0300
commit62342b5ad8522da5cbc0623f2b645c48b31c2838 (patch)
tree71cef270090969e33b68825dfa003efc25ff5602 /io.c
parent525d6122c57db7b5f193b1fc22dc680a44f6c962 (diff)
parent43a645fe05c57576d9d41a7f3b18bb55b1dbdc3e (diff)
downloadegawk-62342b5ad8522da5cbc0623f2b645c48b31c2838.tar.gz
egawk-62342b5ad8522da5cbc0623f2b645c48b31c2838.tar.bz2
egawk-62342b5ad8522da5cbc0623f2b645c48b31c2838.zip
Merge branch 'master' into feature/cmake
Diffstat (limited to 'io.c')
-rw-r--r--io.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/io.c b/io.c
index 335e1255..fafc1003 100644
--- a/io.c
+++ b/io.c
@@ -1391,7 +1391,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)) {
@@ -1407,6 +1407,7 @@ flush_io()
status++;
}
}
+ }
if (status != 0)
status = -1; /* canonicalize it */
return status;
@@ -2602,6 +2603,12 @@ 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) {
+ if (is_non_fatal_redirect(redir_exp->stptr)) {
+ update_ERRNO_int(EBADF);
+ return make_number((AWKNUM) -1.0);
+ }
+ fatal(_("getline: attempt to read from closed read end of two-way pipe"));
}
iop = rp->iop;
if (iop == NULL) /* end of input */