Commit ded2f295 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

pty: return EINVAL for TIOCGPTN for BSD ptys

Commit bbb63c51 (drivers:tty:fix up
ENOIOCTLCMD error handling) changed the default return value from tty
ioctl to be ENOTTY and not EINVAL. This is appropriate.

But in case of TIOCGPTN for the old BSD ptys glibc started failing
because it expects EINVAL to be returned. Only then it continues to
obtain the pts name the other way around.

So fix this case by explicit return of EINVAL in this case.
Signed-off-by: default avatarJiri Slaby <>
Reported-by: default avatarFlorian Westphal <>
Cc: Alan Cox <>
Cc: stable <> # 3.7+
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 5dd070d2
......@@ -441,6 +441,8 @@ static int pty_bsd_ioctl(struct tty_struct *tty,
return pty_get_pktmode(tty, (int __user *)arg);
case TIOCSIG: /* Send signal to other side of pty */
return pty_signal(tty, (int) arg);
case TIOCGPTN: /* TTY returns ENOTTY, but glibc expects EINVAL here */
return -EINVAL;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment