gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2463-gbd6dc2


From: Eli Zaretskii
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2463-gbd6dc29
Date: Sat, 8 Apr 2017 07:37:20 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, master has been updated
       via  bd6dc293e35fdeac05bd1577593e111fd09d22b7 (commit)
      from  947dfae8571472b6e78aecad8da024f1f65e5bf5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=bd6dc293e35fdeac05bd1577593e111fd09d22b7

commit bd6dc293e35fdeac05bd1577593e111fd09d22b7
Author: Eli Zaretskii <address@hidden>
Date:   Sat Apr 8 14:37:13 2017 +0300

    Fix EPIPE handling in the MinGW build.

diff --git a/ChangeLog b/ChangeLog
index 6822c6f..e655ebc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2017-04-08  Eli Zaretskii  <address@hidden>
+
+       * main.c (usage, copyleft) [__MINGW32__]:
+       * io.c (non_fatal_flush_std_file, close_io) [__MINGW32__]: Call
+       w32_maybe_set_errno to correctly set errno to EPIPE when appropriate.
+
+       * awk.h (die_via_sigpipe) [__MINGW32__]: MinGW-specific definition.
+
 2017-03-27         Arnold D. Robbins     <address@hidden>
 
        Cause EPIPE errors to stdout to generate a real SIGPIPE.
diff --git a/awk.h b/awk.h
index c1e9b4a..a0af579 100644
--- a/awk.h
+++ b/awk.h
@@ -1970,5 +1970,10 @@ erealloc_real(void *ptr, size_t count, const char 
*where, const char *var, const
 #else
 #define ignore_sigpipe()
 #define set_sigpipe_to_default()
+#ifdef __MINGW32__
+/* 0xC0000008 is EXCEPTION_INVALID_HANDLE, somewhat appropriate for EPIPE */
+#define die_via_sigpipe() exit(0xC0000008)
+#else  /* !__MINGW32__ */
 #define die_via_sigpipe() exit(EXIT_FATAL)
+#endif /* !__MINGW32__ */
 #endif
diff --git a/io.c b/io.c
index b00f4db..f854ec5 100644
--- a/io.c
+++ b/io.c
@@ -1399,6 +1399,10 @@ non_fatal_flush_std_file(FILE *fp)
                bool is_fatal = ! is_non_fatal_std(fp);
 
                if (is_fatal) {
+#ifdef __MINGW32__
+                       if (errno == 0 || errno == EINVAL)
+                               w32_maybe_set_errno();
+#endif
                        if (errno == EPIPE)
                                die_via_sigpipe();
                        else
@@ -1494,12 +1498,20 @@ close_io(bool *stdio_problem)
        *stdio_problem = false;
        /* we don't warn about stdout/stderr if EPIPE, but we do error exit */
        if (fflush(stdout) != 0) {
+#ifdef __MINGW32__
+               if (errno == 0 || errno == EINVAL)
+                       w32_maybe_set_errno();
+#endif
                if (errno != EPIPE)
                        warning(_("error writing standard output (%s)"), 
strerror(errno));
                status++;
                *stdio_problem = true;
        }
        if (fflush(stderr) != 0) {
+#ifdef __MINGW32__
+               if (errno == 0 || errno == EINVAL)
+                       w32_maybe_set_errno();
+#endif
                if (errno != EPIPE)
                        warning(_("error writing standard error (%s)"), 
strerror(errno));
                status++;
diff --git a/main.c b/main.c
index 530d37f..b6841d5 100644
--- a/main.c
+++ b/main.c
@@ -627,6 +627,10 @@ By default it reads standard input and writes standard 
output.\n\n"), fp);
        fflush(fp);
 
        if (ferror(fp)) {
+#ifdef __MINGW32__
+               if (errno == 0 || errno == EINVAL)
+                       w32_maybe_set_errno();
+#endif
                /* don't warn about stdout/stderr if EPIPE, but do error exit */
                if (errno == EPIPE)
                        die_via_sigpipe();
@@ -673,6 +677,10 @@ along with this program. If not, see 
http://www.gnu.org/licenses/.\n";);
        fflush(stdout);
 
        if (ferror(stdout)) {
+#ifdef __MINGW32__
+               if (errno == 0 || errno == EINVAL)
+                       w32_maybe_set_errno();
+#endif
                /* don't warn about stdout if EPIPE, but do error exit */
                if (errno != EPIPE)
                        warning(_("error writing standard output (%s)"), 
strerror(errno));

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog |  8 ++++++++
 awk.h     |  5 +++++
 io.c      | 12 ++++++++++++
 main.c    |  8 ++++++++
 4 files changed, 33 insertions(+)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]