* common/filestuff.c (gdb_fopen_cloexec): Do not try to use "e"

mode if operating system doesn't know O_CLOEXEC.
This commit is contained in:
Pierre Muller 2013-09-14 06:26:35 +00:00
parent 556a4ec59c
commit 88505fac1c
2 changed files with 14 additions and 1 deletions

View 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.

View 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)
{