From: Mike Frysinger Date: Thu, 9 Apr 2009 07:08:04 +0000 (-0000) Subject: patch by Stuart Hughes and Guenter to make "0" a... X-Git-Tag: 1_14_0~53 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=fe013a74ff46cf53ec85d00f693ed72cbeef4eda;p=oweals%2Fbusybox.git patch by Stuart Hughes and Guenter to make "0" a special baud rate for getty where it uses this as "leave baud rate unchanged" --- 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) debug("entered parse_speeds\n"); while ((cp = strsep(&arg, ",")) != NULL) { op->speeds[op->numspeed] = bcode(cp); - if (op->speeds[op->numspeed] <= 0) + if (op->speeds[op->numspeed] < 0) bb_error_msg_and_die("bad speed: %s", cp); + else if (op->speeds[op->numspeed] == 0) { + struct termios tio; + if (tcgetattr(1, &tio) != 0) + bb_error_msg_and_die("auto baudrate detection failed"); + op->speeds[op->numspeed] = cfgetospeed(&tio); + } op->numspeed++; if (op->numspeed > MAX_SPEED) bb_error_msg_and_die("too many alternate speeds");