From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6163 invoked by alias); 9 Oct 2013 17:02:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 6143 invoked by uid 89); 9 Oct 2013 17:02:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mtaout22.012.net.il Received: from mtaout22.012.net.il (HELO mtaout22.012.net.il) (80.179.55.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 09 Oct 2013 17:02:23 +0000 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MUE00A00VB99N00@a-mtaout22.012.net.il> for gdb-patches@sourceware.org; Wed, 09 Oct 2013 20:02:17 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MUE009K1VBOXZ80@a-mtaout22.012.net.il>; Wed, 09 Oct 2013 20:02:12 +0300 (IDT) Date: Wed, 09 Oct 2013 17:02:00 -0000 From: Eli Zaretskii Subject: Re: [patch] Minor O_CLOEXEC optimization, "regression" fix In-reply-to: <20131009131016.GA1603@host2.jankratochvil.net> To: Jan Kratochvil Cc: ktietz@redhat.com, gdb-patches@sourceware.org, tromey@redhat.com Reply-to: Eli Zaretskii Message-id: <83hacqqsx7.fsf@gnu.org> References: <20131008183214.GB27355@host2.jankratochvil.net> <87li23fsym.fsf@fleche.redhat.com> <20131009131016.GA1603@host2.jankratochvil.net> X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00289.txt.bz2 > Date: Wed, 9 Oct 2013 15:10:16 +0200 > From: Jan Kratochvil > Cc: gdb-patches@sourceware.org, Tom Tromey > > On Tue, 08 Oct 2013 21:44:33 +0200, Tom Tromey wrote: > > >>>>> "Jan" == Jan Kratochvil writes: > > Jan> - if (result == NULL) > > Jan> + if (result != NULL) > > Jan> + fopen_e_ever_succeeded = 1; > > Jan> + else if (!fopen_e_ever_succeeded) > > > > What if we have it check for EINVAL instead? > > 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. Please don't do that. On latest versions of Windows, the runtime library functions tend to invoke the "invalid parameter handler" in these cases, which more often than not will crash the program.