* common/filestuff.c (gdb_fopen_cloexec): Do not try to use "e"
authorPierre Muller <muller@sourceware.org>
Sat, 14 Sep 2013 06:26:35 +0000 (06:26 +0000)
committerPierre Muller <muller@sourceware.org>
Sat, 14 Sep 2013 06:26:35 +0000 (06:26 +0000)
mode if operating system doesn't know O_CLOEXEC.

gdb/ChangeLog
gdb/common/filestuff.c

index 54c37abcd4a2052a757cd907a32df3e33adcf5a7..dd25f6af4d9698f9c4f83353edcfae68815bb52f 100644 (file)
@@ -1,3 +1,10 @@
+2013-09-14  Pierre Muller  <muller@sourceware.org>
+           Tom Tromey  <tromey@redhat.com>
+           Pedro Alves  <palves@redhat.com>
+
+       * common/filestuff.c (gdb_fopen_cloexec): Do not try to use "e"
+       mode if operating system doesn't know O_CLOEXEC.
+
 2013-09-13  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Code cleanup.
index 7d1a69a5a79fae2e338f5fe9055c06525f1cf25e..d3b13e8c806e9545260709d95fda2758c1b0e54e 100644 (file)
@@ -311,7 +311,13 @@ FILE *
 gdb_fopen_cloexec (const char *filename, const char *opentype)
 {
   FILE *result = NULL;
-  static int fopen_e_ever_failed;
+  /* Probe for "e" support once.  But, if we can tell the operating
+     system doesn't know about close on exec mode "e" without probing,
+     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 = O_CLOEXEC == 0;
 
   if (!fopen_e_ever_failed)
     {
This page took 0.031586 seconds and 4 git commands to generate.