[binutils-gdb] Avoid "Invalid parameter passed to C runtime function" warning
Eli Zaretskii
eliz@sourceware.org
Tue Nov 20 16:52:00 GMT 2018
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=970d89d8fdd84b31decaf3bd84e785aad057ea32
commit 970d89d8fdd84b31decaf3bd84e785aad057ea32
Author: Eli Zaretskii <eliz@gnu.org>
Date: Tue Nov 20 18:49:43 2018 +0200
Avoid "Invalid parameter passed to C runtime function" warning
This warning was displayed by OutputDebugString on MinGW when
GDB was being debugged natively.
gdb/ChangeLog:
* common/filestuff.c (gdb_fopen_cloexec): Disable use of "e" mode
with 'fopen' also if O_CLOEXEC is equal to O_NOINHERIT, to cater
to MinGW fixed by Gnulib.
Diff:
---
gdb/ChangeLog | 6 ++++++
gdb/common/filestuff.c | 6 ++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 252ef58..5fe8267 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2018-11-20 Eli Zaretskii <eliz@gnu.org>
+
+ * common/filestuff.c (gdb_fopen_cloexec): Disable use of "e" mode
+ with 'fopen' also if O_CLOEXEC is equal to O_NOINHERIT, to cater
+ to MinGW fixed by Gnulib.
+
2018-11-19 John Darrington <john@darrington.wattle.id.au>
*s12z-tdep.c (s12z_frame_cache): Add an assertion.
diff --git a/gdb/common/filestuff.c b/gdb/common/filestuff.c
index d4bd1a8..3fa035a 100644
--- a/gdb/common/filestuff.c
+++ b/gdb/common/filestuff.c
@@ -300,8 +300,10 @@ gdb_fopen_cloexec (const char *filename, const char *opentype)
skip it. E.g., the Windows runtime issues an "Invalid parameter
passed to C runtime function" OutputDebugString warning for
unknown modes. Assume that if O_CLOEXEC is zero, then "e" isn't
- supported. */
- static int fopen_e_ever_failed_einval = O_CLOEXEC == 0;
+ supported. On MinGW, O_CLOEXEC is an alias of O_NOINHERIT, and
+ "e" isn't supported. */
+ static int fopen_e_ever_failed_einval =
+ O_CLOEXEC == 0 || O_CLOEXEC == O_NOINHERIT;
if (!fopen_e_ever_failed_einval)
{
More information about the Gdb-cvs
mailing list