From: Alan Cox Having split out the user and kernel structures it turns out that some non glibc C libraries pull their termios struct from the kernel headers directly or indirectly. This means we must keep "struct termios" as the library sees it correct for the old ioctls. Not a big problem just shuffle the names and ifdef around a bit Signed-off-by: Alan Cox Signed-off-by: Andrew Morton --- drivers/char/tty_ioctl.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff -puN drivers/char/tty_ioctl.c~tty_ioctl-use-termios-for-the-old-structure-and-termios2 drivers/char/tty_ioctl.c --- a/drivers/char/tty_ioctl.c~tty_ioctl-use-termios-for-the-old-structure-and-termios2 +++ a/drivers/char/tty_ioctl.c @@ -408,14 +408,18 @@ static int set_termios(struct tty_struct } else if (opt & TERMIOS_OLD) { memcpy(&tmp_termios, tty->termios, sizeof(struct termios)); if (user_termios_to_kernel_termios_1(&tmp_termios, - (struct termios_v1 __user *)arg)) + (struct termios __user *)arg)) return -EFAULT; -#endif } else { if (user_termios_to_kernel_termios(&tmp_termios, - (struct termios __user *)arg)) + (struct termios2 __user *)arg)) return -EFAULT; } +#else + else if (user_termios_to_kernel_termios(&tmp_termios, + (struct termios __user *)arg)) + return -EFAULT; +#endif /* If old style Bfoo values are used then load c_ispeed/c_ospeed with the real speed so its unconditionally usable */ @@ -707,11 +711,11 @@ int n_tty_ioctl(struct tty_struct * tty, return 0; #else case TCGETS: - if (kernel_termios_to_user_termios_1((struct termios_v1 __user *)arg, real_tty->termios)) + if (kernel_termios_to_user_termios_1((struct termios __user *)arg, real_tty->termios)) return -EFAULT; return 0; case TCGETS2: - if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios)) + if (kernel_termios_to_user_termios((struct termios2 __user *)arg, real_tty->termios)) return -EFAULT; return 0; case TCSETSF2: _