From 88505fac1ca9ffbe312908898d62d04d18a9bf47 Mon Sep 17 00:00:00 2001 From: Pierre Muller Date: Sat, 14 Sep 2013 06:26:35 +0000 Subject: * common/filestuff.c (gdb_fopen_cloexec): Do not try to use "e" mode if operating system doesn't know O_CLOEXEC. --- gdb/common/filestuff.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gdb/common') diff --git a/gdb/common/filestuff.c b/gdb/common/filestuff.c index 7d1a69a..d3b13e8 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) { -- cgit v1.1