[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-988
From: |
Eli Zaretskii |
Subject: |
[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-988-g3fa6f02 |
Date: |
Fri, 4 Nov 2016 07:49:06 +0000 (UTC) |
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, gawk-4.1-stable has been updated
via 3fa6f02daabc1bf2cc21f7854c4af990627a8863 (commit)
from 95aa1b0f60981430eb5cca81ead2d86d3c2793e1 (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=3fa6f02daabc1bf2cc21f7854c4af990627a8863
commit 3fa6f02daabc1bf2cc21f7854c4af990627a8863
Author: Eli Zaretskii <address@hidden>
Date: Fri Nov 4 09:48:28 2016 +0200
Improve behavior on MS-Windows when stdout is redirected to a pipe.
diff --git a/ChangeLog b/ChangeLog
index 9bed030..ecd371b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-11-04 Eli Zaretskii <address@hidden>
+
+ * builtin.c (efwrite) [__MINGW32__]: Call w32_maybe_set_errno if
+ errno is not set or set to EINVAL.
+
+ * nonposix.h (w32_maybe_set_errno) [__MINGW32__]: Add prototype.
+
2016-10-26 Arnold D. Robbins <address@hidden>
* io.c (init_awkpath): Set max path len for leading separator.
diff --git a/builtin.c b/builtin.c
index 0163b81..18c01f6 100644
--- a/builtin.c
+++ b/builtin.c
@@ -125,6 +125,10 @@ efwrite(const void *ptr,
return;
wrerror:
+#ifdef __MINGW32__
+ if (errno == 0 || errno == EINVAL)
+ w32_maybe_set_errno();
+#endif
/* die silently on EPIPE to stdout */
if (fp == stdout && errno == EPIPE)
gawk_exit(EXIT_FATAL);
diff --git a/nonposix.h b/nonposix.h
index 3aae512..b349789 100644
--- a/nonposix.h
+++ b/nonposix.h
@@ -55,6 +55,7 @@ unsigned int getegid (void);
/* gawkmisc.pc */
int unsetenv (const char *);
int setenv (const char *, const char *, int);
+void w32_maybe_set_errno (void);
#endif /* __MINGW32__ */
#if defined(VMS) || defined(__DJGPP__) || defined(__MINGW32__)
diff --git a/pc/ChangeLog b/pc/ChangeLog
index 7ba5fd9..1ff3bb1 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-04 Eli Zaretskii <address@hidden>
+
+ * gawkmisc.pc (w32_maybe_set_errno) [__MINGW32__]: New function,
+ to correct errno when it is not set to a useful value.
+
2016-09-24 Eli Zaretskii <address@hidden>
Fix compilation warnings on MinGW with the latest runtime.
diff --git a/pc/gawkmisc.pc b/pc/gawkmisc.pc
index 9939fb4..817e816 100644
--- a/pc/gawkmisc.pc
+++ b/pc/gawkmisc.pc
@@ -1,6 +1,4 @@
-/*
- * gawkmisc.c --- miscellaneous gawk routines that are OS specific.
- */
+/* gawkmisc.c --- miscellaneous gawk routines that are OS specific. -*-C-*- */
/*
* Copyright (C) 1986, 1988, 1989, 1991 - 2003, 2012, 2016
@@ -897,6 +895,28 @@ w32_status_to_termsig (unsigned status)
return SIGTERM;
}
+void
+w32_maybe_set_errno (void)
+{
+ DWORD w32err = GetLastError ();
+
+ switch (w32err)
+ {
+ /* When stdout is redirected to a pipe, and the program that
+ reads the pipe (e.g., a pager) exits, Windows doesn't set
+ errno to a useful value. Help it DTRT. */
+ case ERROR_BAD_PIPE:
+ case ERROR_PIPE_BUSY:
+ case ERROR_NO_DATA:
+ case ERROR_PIPE_NOT_CONNECTED:
+ errno = EPIPE;
+ break;
+ default:
+ errno = EINVAL;
+ break;
+ }
+}
+
#endif /* __MINGW32__ */
#if defined(__DJGPP__) || defined(__MINGW32__) || defined(__EMX__)
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 7 +++++++
builtin.c | 4 ++++
nonposix.h | 1 +
pc/ChangeLog | 5 +++++
pc/gawkmisc.pc | 26 +++++++++++++++++++++++---
5 files changed, 40 insertions(+), 3 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-988-g3fa6f02,
Eli Zaretskii <=