This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/2] openpty: use TIOCGPTPEER to open slave side fd
- From: Florian Weimer <fweimer at redhat dot com>
- To: Christian Brauner <christian dot brauner at ubuntu dot com>, libc-alpha at sourceware dot org, stgraber at stgraber dot org, serge at hallyn dot com
- Date: Mon, 28 Aug 2017 09:34:11 +0200
- Subject: Re: [PATCH 2/2] openpty: use TIOCGPTPEER to open slave side fd
- Authentication-results: sourceware.org; auth=none
- 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 at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 425B6C049D7F
- References: <20170826134449.26527-1-christian.brauner@ubuntu.com> <20170826134449.26527-2-christian.brauner@ubuntu.com>
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