aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2016-04-06 05:54:19 +0300
committerArnold D. Robbins <arnold@skeeve.com>2016-04-06 05:54:19 +0300
commitcfb773bb093dadfa715816c75d438f97e387e71a (patch)
tree293aedc7402a7c1e25af42f235133ce9caa77b25 /io.c
parentdb6e8faca70e60d2fa80e0affda3d9bef1e82eae (diff)
downloadegawk-cfb773bb093dadfa715816c75d438f97e387e71a.tar.gz
egawk-cfb773bb093dadfa715816c75d438f97e387e71a.tar.bz2
egawk-cfb773bb093dadfa715816c75d438f97e387e71a.zip
Allow r/w for a partially closed two-way pipe to be nonfatal.
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/io.c b/io.c
index 719601c2..fafc1003 100644
--- a/io.c
+++ b/io.c
@@ -2604,6 +2604,10 @@ do_getline_redir(int into_variable, enum redirval redirtype)
}
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;