From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48182 invoked by alias); 27 May 2019 17:55:14 -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 48173 invoked by uid 89); 27 May 2019 17:55:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: mail-wr1-f44.google.com Received: from mail-wr1-f44.google.com (HELO mail-wr1-f44.google.com) (209.85.221.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 27 May 2019 17:55:12 +0000 Received: by mail-wr1-f44.google.com with SMTP id d9so17595169wrx.0 for ; Mon, 27 May 2019 10:55:11 -0700 (PDT) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:4eeb:42ff:feef:f164? ([2001:8a0:f913:f700:4eeb:42ff:feef:f164]) by smtp.gmail.com with ESMTPSA id t194sm788015wmt.3.2019.05.27.10.55.09 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Mon, 27 May 2019 10:55:09 -0700 (PDT) Subject: Re: [RFAv3 4/6] Implement | (pipe) command. To: Philippe Waroquiers , gdb-patches@sourceware.org References: <20190504161753.15530-1-philippe.waroquiers@skynet.be> <20190504161753.15530-5-philippe.waroquiers@skynet.be> From: Pedro Alves Message-ID: Date: Mon, 27 May 2019 17:55:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-05/txt/msg00594.txt.bz2 On 5/27/19 6:48 PM, Pedro Alves wrote: > stdio_file's destructor calls fclose unless you tell it otherwise: > > /* Create a ui_file from a previously opened FILE. CLOSE_P > indicates whether the underlying file should be closed when the > stdio_file is destroyed. */ > explicit stdio_file (FILE *file, bool close_p = false); > >> + >> + execute_command_to_ui_file (&pipe_file, gdb_cmd.c_str (), from_tty); > So here this is calling fclose before leaving the scope. But popen > FILE's should be closed with pclose, only. I don't know why it isn't > causing problems, may be the glibc's fclose does nothing in this case. > We shouldn't rely on that. > Ahahaha. The argument defaults to false, not true. Silly me. Thanks, Pedro Alves