diff options
| -rw-r--r-- | loginutils/getty.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/loginutils/getty.c b/loginutils/getty.c index 467316fb8..0398ea3f9 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c | |||
| @@ -163,8 +163,14 @@ static void parse_speeds(struct options *op, char *arg) | |||
| 163 | debug("entered parse_speeds\n"); | 163 | debug("entered parse_speeds\n"); |
| 164 | while ((cp = strsep(&arg, ",")) != NULL) { | 164 | while ((cp = strsep(&arg, ",")) != NULL) { |
| 165 | op->speeds[op->numspeed] = bcode(cp); | 165 | op->speeds[op->numspeed] = bcode(cp); |
| 166 | if (op->speeds[op->numspeed] <= 0) | 166 | if (op->speeds[op->numspeed] < 0) |
| 167 | bb_error_msg_and_die("bad speed: %s", cp); | 167 | bb_error_msg_and_die("bad speed: %s", cp); |
| 168 | else if (op->speeds[op->numspeed] == 0) { | ||
| 169 | struct termios tio; | ||
| 170 | if (tcgetattr(1, &tio) != 0) | ||
| 171 | bb_error_msg_and_die("auto baudrate detection failed"); | ||
| 172 | op->speeds[op->numspeed] = cfgetospeed(&tio); | ||
| 173 | } | ||
| 168 | op->numspeed++; | 174 | op->numspeed++; |
| 169 | if (op->numspeed > MAX_SPEED) | 175 | if (op->numspeed > MAX_SPEED) |
| 170 | bb_error_msg_and_die("too many alternate speeds"); | 176 | bb_error_msg_and_die("too many alternate speeds"); |
