]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Avoid "Invalid parameter passed to C runtime function" warning
authorEli Zaretskii <eliz@gnu.org>
Tue, 20 Nov 2018 16:49:43 +0000 (18:49 +0200)
committerEli Zaretskii <eliz@gnu.org>
Tue, 20 Nov 2018 16:49:43 +0000 (18:49 +0200)
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.

gdb/ChangeLog
gdb/common/filestuff.c

index 252ef5817d03c91f04c1f2ce334318dba9cfb948..5fe8267e213ac30a36233d3ab6812cc165040850 100644 (file)
@@ -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.
index d4bd1a8cb8cd5d5d182121258b2a646ee4bacae4..3fa035a63dd66b26fd094dbf89c141f41d4d7341 100644 (file)
@@ -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)
     {