aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2018-10-10 15:08:12 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2018-10-10 15:08:12 -0700
commit6d23e368456aab8919d10411d8019af27b6effb2 (patch)
tree11f96b3609a78b78e03252cde7139f38e5ce8798
parent286c7797ff49d967b57c71108a0406a94d63ccf4 (diff)
downloadtermbaud-wip.termbaud.tar.gz
termbaud-wip.termbaud.tar.xz
termbaud-wip.termbaud.zip
cfsetispeed(termios_p, B0) should copy ispeed from ospeedwip.termbaud
The c_ispeed field is always set, even if the input speed is B0. Thus, if we set the input speed to B0 (== 0) then we should copy the c_ispeed field from c_ospeed.
-rw-r--r--sysdeps/unix/sysv/linux/speed.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/speed.c b/sysdeps/unix/sysv/linux/speed.c
index 49be72b0026..5b92dc968fc 100644
--- a/sysdeps/unix/sysv/linux/speed.c
+++ b/sysdeps/unix/sysv/linux/speed.c
@@ -366,7 +366,10 @@ cfsetispeed (struct termios *termios_p, speed_t speed)
return -1;
}
- termios_p->c_ispeed = speed_kernel_from_user (speed);
+ if ( speed == B0 )
+ termios_p->c_ispeed = termios_p->c_ospeed;
+ else
+ termios_p->c_ispeed = speed_kernel_from_user (speed);
if ( (speed & ~CBAUD) != 0 || speed > _MAX_BAUD )
speed = BOTHER;