summaryrefslogtreecommitdiff
path: root/gdb/common
diff options
context:
space:
mode:
authorPierre Muller <muller@ics.u-strasbg.fr>2013-09-14 06:26:34 +0000
committerPierre Muller <muller@ics.u-strasbg.fr>2013-09-14 06:26:34 +0000
commit0b96102a98036bbff145f79ebcd22f0cfdb78986 (patch)
tree015ea2ada5e060862552eba5bb527f13b7e5bc86 /gdb/common
parent5d36ed4b1b0c71f42c547cabe8e2e6ebf32e8593 (diff)
downloadgdb-0b96102a98036bbff145f79ebcd22f0cfdb78986.tar.gz
* common/filestuff.c (gdb_fopen_cloexec): Do not try to use "e"
mode if operating system doesn't know O_CLOEXEC.
Diffstat (limited to 'gdb/common')
-rw-r--r--gdb/common/filestuff.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gdb/common/filestuff.c b/gdb/common/filestuff.c
index 7d1a69a5a79..d3b13e8c806 100644
--- a/gdb/common/filestuff.c
+++ b/gdb/common/filestuff.c
@@ -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)
{