aboutsummaryrefslogtreecommitdiff
path: root/drivers/char/tty_ioctl.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-12-08 02:38:47 -0800
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-08 08:28:57 -0800
commit64bb6c5e1ddcd47c951740485026ef08975ee2e6 (patch)
treea27f48dd4e9f123dcbc961e4660d55dae25b8e6b /drivers/char/tty_ioctl.c
parent606d099cdd1080bbb50ea50dc52d98252f8f10a1 (diff)
[PATCH] tty_ioctl: use termios for the old structure and termios2 for the new
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 [akpm@osdl.org: build fix] Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/tty_ioctl.c')
-rw-r--r--drivers/char/tty_ioctl.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index 30486df9fd3..dee47f40c6a 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -399,23 +399,27 @@ static int set_termios(struct tty_struct * tty, void __user *arg, int opt)
if (retval)
return retval;
+ memcpy(&tmp_termios, tty->termios, sizeof(struct ktermios));
+
if (opt & TERMIOS_TERMIO) {
- memcpy(&tmp_termios, tty->termios, sizeof(struct ktermios));
if (user_termio_to_kernel_termios(&tmp_termios,
(struct termio __user *)arg))
return -EFAULT;
#ifdef TCGETS2
} 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, struct file * file,
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: