aboutsummaryrefslogtreecommitdiff
path: root/gdb/common
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2018-11-20 18:49:43 +0200
committerEli Zaretskii <eliz@gnu.org>2018-11-20 18:49:43 +0200
commit970d89d8fdd84b31decaf3bd84e785aad057ea32 (patch)
tree4aa3ef02a23ebb836035afafb77e81f738739d75 /gdb/common
parentf92f9e8780f74c5084c59689f91d28b8a3471538 (diff)
downloadbinutils-970d89d8fdd84b31decaf3bd84e785aad057ea32.zip
binutils-970d89d8fdd84b31decaf3bd84e785aad057ea32.tar.gz
binutils-970d89d8fdd84b31decaf3bd84e785aad057ea32.tar.bz2
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.
Diffstat (limited to 'gdb/common')
-rw-r--r--gdb/common/filestuff.c6
1 files changed, 4 insertions, 2 deletions
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)
{