From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24126 invoked by alias); 6 Dec 2008 15:58:50 -0000 Received: (qmail 24109 invoked by uid 22791); 6 Dec 2008 15:58:48 -0000 X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 06 Dec 2008 15:58:13 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id mB6Fw9wP016805; Sat, 6 Dec 2008 10:58:09 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id mB6Fw5VU004663; Sat, 6 Dec 2008 10:58:06 -0500 Received: from opsy.redhat.com (vpn-12-152.rdu.redhat.com [10.11.12.152]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id mB6Fw5nf014542; Sat, 6 Dec 2008 10:58:05 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 550493785F7; Sat, 6 Dec 2008 08:58:04 -0700 (MST) To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: RFA: close-on-exec internal file descriptors References: From: Tom Tromey Reply-To: Tom Tromey Date: Sat, 06 Dec 2008 15:58:00 -0000 In-Reply-To: (Eli Zaretskii's message of "Sat\, 06 Dec 2008 10\:13\:21 +0200") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 X-SW-Source: 2008-12/txt/msg00112.txt.bz2 >>>>> "Eli" == Eli Zaretskii writes: >> I believe those 'pipe' entries are from the call to pipe in >> linux-nat.c:linux_nat_set_async. Eli> Are you saying that the problem is specific to Linux native targets? No. That was an example. >> I chose to take advantage of the new glibc flags like O_CLOEXEC when >> they are available. Eli> Relying on glibc is OK for GNU/Linux, but you seem to be modifying Eli> files that have no relation to the Linux native builds. Does that Eli> mean the non-glibc builds that don't have the support you are relying Eli> on will still leak descriptors? No. In each case, if O_CLOEXEC is not available, we fall back to the fcntl-based method. That is what the calls to "close_on_exec" do in the patch. >> + char new_mode[20]; >> + strcpy (new_mode, mode); >> + strcat (new_mode, "e"); >> + return fopen (path, new_mode); Eli> Can we do something more safe than this arbitrary [20] limitation? I don't think there is any point, because the mode argument to fopen is never longer than 4 characters or so. However, if you really want this, I will change it to a malloc. Tom