From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78099 invoked by alias); 29 Aug 2017 14:12:23 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 78085 invoked by uid 89); 29 Aug 2017 14:12:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=H*r:gmail.com, H*RU:gmail.com, Hx-spam-relays-external:gmail.com X-HELO: youngberry.canonical.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=iSoiEebFhmBH+oQGVfWXFwAqx//RbmEzO0QFf0gD2Ps=; b=f9s5JROIlKoem61wAx/4fPkq2grZ2Jy1QW2z5eWLd2q4JFgmJaOREVn/5aOakxsX1C YHEWCZZdIN8xOADBaRZvyo4DteFoXBqss/YUSpyVzFaXSratSnEABhR9cyqeN/UwKTzW NDT+DW+7LPZEqQQYJZBFfS5bpkDmGCQaJsT67B1ddQXR1dX6JzmgD6GijRdp8UlozhVr ysuu/3twBkB7wWbaKI414iYZuDXFYYNdye+0Hf8q70FI0nJ5lAmkz8AD0DBseu+DYoYl OBbt821NtxLV8BdRrlMSyWN4irPxH+0GUCrZFNVxiVUETHB4MiKWG7T8zkJBsiaaWjPY JOiw== X-Gm-Message-State: AHYfb5gxiwVMejrhOz9jJ1lkm3jVg6ydK2N/4d5bgSOokNmXDlYMFZVH BILqhpiJ4pVKLVfC7KVI5VtV4eSBqTUvMsazVvgKxxzlCPf9GkMGpx+VpFBkZNmIpeTVNqWcxKM dj4z1xpXRgLMnY0YZbBron9knNKlT X-Received: by 10.28.15.6 with SMTP id 6mr2786550wmp.0.1504015929880; Tue, 29 Aug 2017 07:12:09 -0700 (PDT) X-Received: by 10.28.15.6 with SMTP id 6mr2786512wmp.0.1504015928838; Tue, 29 Aug 2017 07:12:08 -0700 (PDT) Date: Tue, 29 Aug 2017 14:12:00 -0000 From: Christian Brauner To: Andreas Schwab Cc: Christian Brauner , libc-alpha@sourceware.org, stgraber@stgraber.org, serge@hallyn.com, fweimer@redhat.com, joseph@codesourcery.com Subject: Re: [PATCH 1/2 v4] openpty: close slave pty fd on error Message-ID: <20170829141207.fuhxzfqihtw6ixb7@gmail.com> References: <20170829134515.9345-1-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) X-SW-Source: 2017-08/txt/msg01237.txt.bz2 On Tue, Aug 29, 2017 at 04:00:26PM +0200, Andreas Schwab wrote: > On Aug 29 2017, Christian Brauner wrote: > > > @@ -129,12 +124,17 @@ openpty (int *amaster, int *aslave, char *name, > > if (name != NULL) > > strcpy (name, buf); > > > > + ret = 0; > > + > > + on_error: > > + close (master); > > + > > + if (slave != -1) > > + close(slave); > > + > > You don't want to close the fds on success. Sorry, I was inatentive. > > Andreas. > > -- > Andreas Schwab, SUSE Labs, schwab@suse.de > GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 > "And now for something completely different."