iconv: fix missing bounds checking for shift_jis decoding
[musl.git] / src / termios / cfsetospeed.c
blobc9cbdd9d9d2e1f7f3ba78567fc13fae28ad721d7
1 #define _BSD_SOURCE
2 #include <termios.h>
3 #include <sys/ioctl.h>
4 #include <errno.h>
6 int cfsetospeed(struct termios *tio, speed_t speed)
8 if (speed & ~CBAUD) {
9 errno = EINVAL;
10 return -1;
12 tio->c_cflag &= ~CBAUD;
13 tio->c_cflag |= speed;
14 return 0;
17 int cfsetispeed(struct termios *tio, speed_t speed)
19 return speed ? cfsetospeed(tio, speed) : 0;
22 weak_alias(cfsetospeed, cfsetspeed);