diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2018-06-17 21:52:28 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2018-06-17 21:52:28 +0300 |
commit | edaf82c330629586b1158a3dec407d53084b02e3 (patch) | |
tree | 60774046dec03325ad6e14846c2e25edafe6ba2f /io.c | |
parent | 63c5726f8c7bc3c0e6457840049d83d6a2f09995 (diff) | |
download | egawk-edaf82c330629586b1158a3dec407d53084b02e3.tar.gz egawk-edaf82c330629586b1158a3dec407d53084b02e3.tar.bz2 egawk-edaf82c330629586b1158a3dec407d53084b02e3.zip |
Fix a corner case with EPIPE to stdout/stderr.
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1474,12 +1474,13 @@ flush_io() /* close_io --- close all open files, called when exiting */ int -close_io(bool *stdio_problem) +close_io(bool *stdio_problem, bool *got_EPIPE) { struct redirect *rp; struct redirect *next; int status = 0; + *stdio_problem = *got_EPIPE = false; errno = 0; for (rp = red_head; rp != NULL; rp = next) { next = rp->next; @@ -1505,6 +1506,9 @@ close_io(bool *stdio_problem) #endif if (errno != EPIPE) warning(_("error writing standard output (%s)"), strerror(errno)); + else + *got_EPIPE = true; + status++; *stdio_problem = true; } @@ -1515,6 +1519,9 @@ close_io(bool *stdio_problem) #endif if (errno != EPIPE) warning(_("error writing standard error (%s)"), strerror(errno)); + else + *got_EPIPE = true; + status++; *stdio_problem = true; } |