|
|
147e83 |
diff -Nru glibc-2.17-c758a686/sysdeps/unix/sysv/linux/tcsetattr.c glibc-2.17-c758a686/sysdeps/unix/sysv/linux/tcsetattr.c
|
|
|
147e83 |
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/tcsetattr.c 2012-06-05 07:42:49.000000000 -0600
|
|
|
147e83 |
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/tcsetattr.c 2012-06-07 12:15:21.831318623 -0600
|
|
|
147e83 |
@@ -48,6 +48,7 @@ tcsetattr (fd, optional_actions, termios
|
|
|
147e83 |
{
|
|
|
147e83 |
struct __kernel_termios k_termios;
|
|
|
147e83 |
unsigned long int cmd;
|
|
|
147e83 |
+ int retval;
|
|
|
147e83 |
|
|
|
147e83 |
switch (optional_actions)
|
|
|
147e83 |
{
|
|
|
147e83 |
@@ -79,6 +80,35 @@ tcsetattr (fd, optional_actions, termios
|
|
|
147e83 |
memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0],
|
|
|
147e83 |
__KERNEL_NCCS * sizeof (cc_t));
|
|
|
147e83 |
|
|
|
147e83 |
- return INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios);
|
|
|
147e83 |
+ retval = INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios);
|
|
|
147e83 |
+
|
|
|
147e83 |
+ if (retval == 0 && cmd == TCSETS)
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ /* The Linux kernel has a bug which silently ignore the invalid
|
|
|
147e83 |
+ c_cflag on pty. We have to check it here. */
|
|
|
147e83 |
+ int save = errno;
|
|
|
147e83 |
+ retval = INLINE_SYSCALL (ioctl, 3, fd, TCGETS, &k_termios);
|
|
|
147e83 |
+ if (retval)
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ /* We cannot verify if the setting is ok. We don't return
|
|
|
147e83 |
+ an error (?). */
|
|
|
147e83 |
+ __set_errno (save);
|
|
|
147e83 |
+ retval = 0;
|
|
|
147e83 |
+ }
|
|
|
147e83 |
+ else if ((termios_p->c_cflag & (PARENB | CREAD))
|
|
|
147e83 |
+ != (k_termios.c_cflag & (PARENB | CREAD))
|
|
|
147e83 |
+ || ((termios_p->c_cflag & CSIZE)
|
|
|
147e83 |
+ && ((termios_p->c_cflag & CSIZE)
|
|
|
147e83 |
+ != (k_termios.c_cflag & CSIZE))))
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ /* It looks like the Linux kernel silently changed the
|
|
|
147e83 |
+ PARENB/CREAD/CSIZE bits in c_cflag. Report it as an
|
|
|
147e83 |
+ error. */
|
|
|
147e83 |
+ __set_errno (EINVAL);
|
|
|
147e83 |
+ retval = -1;
|
|
|
147e83 |
+ }
|
|
|
147e83 |
+ }
|
|
|
147e83 |
+
|
|
|
147e83 |
+ return retval;
|
|
|
147e83 |
}
|
|
|
147e83 |
libc_hidden_def (tcsetattr)
|