This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2] openpty: use TIOCGPTPEER to open slave side fd


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]