[PATCH 2/2] openpty: use TIOCGPTPEER to open slave side fd
Florian Weimer
fweimer@redhat.com
Mon Aug 28 07:34:00 GMT 2017
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
More information about the Libc-alpha
mailing list