diff options
Diffstat (limited to 'termios')
-rw-r--r-- | termios/cfsetspeed.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/termios/cfsetspeed.c b/termios/cfsetspeed.c index da31073ac2..b3c8aa3f42 100644 --- a/termios/cfsetspeed.c +++ b/termios/cfsetspeed.c @@ -107,13 +107,19 @@ cfsetspeed (struct termios *termios_p, speed_t speed) { size_t cnt; - for (cnt = 0; cnt < sizeof (speeds); ++cnt) - if (speed == speeds[cnt].value) + for (cnt = 0; cnt < sizeof (speeds) / sizeof (speeds[0]); ++cnt) + if (speed == speeds[cnt].internal) { cfsetispeed (termios_p, speed); cfsetospeed (termios_p, speed); return; } + else if (speed == speeds[cnt].value) + { + cfsetispeed (termios_p, speeds[cnt].internal); + cfsetospeed (termios_p, speeds[cnt].internal); + return; + } __set_errno (EINVAL); } |