[patch] Minor O_CLOEXEC optimization, "regression" fix

Eli Zaretskii eliz@gnu.org
Wed Oct 9 17:58:00 GMT 2013


> Date: Wed, 9 Oct 2013 19:41:24 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: Tom Tromey <tromey@redhat.com>, ktietz@redhat.com,
>         gdb-patches@sourceware.org
> 
> On Wed, 09 Oct 2013 19:28:54 +0200, Eli Zaretskii wrote:
> > This patch confused me: it tests whether O_CLOEXEC is zero, which it
> > is on Windows, so there should be no need to try "e" at all.
> 
> If O_CLOEXEC is 0 then the "e" flag is not tried at all, therefore it could
> not crash on MS-Windows.

That's what I thought.

> > Therefore, I don't understand why this is still an issue.  What am I
> > missing?
> 
> On platforms where O_CLOEXEC is 0 this new patch has no effect.

Then why did you ask this upthread:

> May one rely on MS-Windows fopen("","re") will fail with EINVAL if it fails
> because of the "e" flag, Kai?  It is in GDB function gdb_fopen_cloexec.

?  That's what confused me.  Sorry if I missed something.



More information about the Gdb-patches mailing list