From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78891 invoked by alias); 28 Aug 2017 07:34:22 -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 77614 invoked by uid 89); 28 Aug 2017 07:34:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 425B6C049D7F Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=fweimer@redhat.com Subject: Re: [PATCH 2/2] openpty: use TIOCGPTPEER to open slave side fd To: Christian Brauner , libc-alpha@sourceware.org, stgraber@stgraber.org, serge@hallyn.com References: <20170826134449.26527-1-christian.brauner@ubuntu.com> <20170826134449.26527-2-christian.brauner@ubuntu.com> From: Florian Weimer Message-ID: <3496d984-a55e-d56b-2c25-a23200327dca@redhat.com> Date: Mon, 28 Aug 2017 07:34:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170826134449.26527-2-christian.brauner@ubuntu.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-08/txt/msg01183.txt.bz2 On 08/26/2017 03:44 PM, Christian Brauner wrote: > +#ifdef TIOCGPTPEER > + slave = ioctl (master, TIOCGPTPEER, O_RDWR | O_NOCTTY); > +#else > if (pts_name (master, &buf, sizeof (_buf))) > goto fail; > > slave = open (buf, O_RDWR | O_NOCTTY); > +#endif I don't think you can #ifdef out existing code this way without introducing failures on older kernels. You need to try the ioctl first, and if that fails, use the old pts_name code. Thanks, Florian