From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8589 invoked by alias); 9 Oct 2013 17:07:17 -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 8577 invoked by uid 89); 9 Oct 2013 17:07:16 -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:07:16 +0000 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MUE00A00VBA9O00@a-mtaout22.012.net.il> for gdb-patches@sourceware.org; Wed, 09 Oct 2013 20:07:14 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MUE00AU4VK1A700@a-mtaout22.012.net.il>; Wed, 09 Oct 2013 20:07:14 +0300 (IDT) Date: Wed, 09 Oct 2013 17:07:00 -0000 From: Eli Zaretskii Subject: Re: [patch] Minor O_CLOEXEC optimization, "regression" fix In-reply-to: <173490856.4156973.1381325657769.JavaMail.root@redhat.com> To: Kai Tietz Cc: jan.kratochvil@redhat.com, gdb-patches@sourceware.org, tromey@redhat.com Reply-to: Eli Zaretskii Message-id: <83fvsaqsou.fsf@gnu.org> References: <20131008183214.GB27355@host2.jankratochvil.net> <87li23fsym.fsf@fleche.redhat.com> <20131009131016.GA1603@host2.jankratochvil.net> <173490856.4156973.1381325657769.JavaMail.root@redhat.com> X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00290.txt.bz2 > Date: Wed, 9 Oct 2013 09:34:17 -0400 (EDT) > From: Kai Tietz > Cc: gdb-patches@sourceware.org, Tom Tromey > > > 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. > > Yes, it fails due the 'e' command in mode. Obviously this option isn't supported on Windows due there is no fork. What does this have to do with fork? Windows does know how to start child processes, so I think making the handle not inherited is the proper equivalent on Windows. Latest runtime libraries have the non-standard 'N' flag. Alternatively, one can make the handle non-inheritable after opening the file, by using a Win32 API. > So yes, probing for EINVAL seems to me like a valid way to probe for valid arguments here. As I wrote earlier, this is not a good idea, as GDB will likely crash on latest Windows versions due to invalid parameter handling in the library.