struct termios term;
speed_t baud;
+ if (tcgetattr(fd, &term) < 0)
+ return SR_ERR;
+
switch (baudrate) {
case 9600:
baud = B9600;
default:
return SR_ERR;
}
-
- if (tcgetattr(fd, &term) < 0)
+ if (cfsetospeed(&term, baud) < 0)
return SR_ERR;
if (cfsetispeed(&term, baud) < 0)
return SR_ERR;