agetty: save the original speed on --keep-baud
agetty cycling through the baud rates specified on command line (triggered by BREAK). Unfortunately, the original baud rate (probably the best one) is tried only first time on --keep-baud. Addresses: https://github.com/karelzak/util-linux/issues/1025 Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
f52eed867a
commit
0d855a8309
|
@ -238,8 +238,10 @@ Change root to the specified directory.
|
|||
Call vhangup() to do a virtual hangup of the specified terminal.
|
||||
.TP
|
||||
\-s, \-\-keep\-baud
|
||||
Try to keep the existing baud rate. The baud rates from
|
||||
the command line are used when agetty receives a BREAK character.
|
||||
Try to keep the existing baud rate. The baud rates from the command line are
|
||||
used when agetty receives a BREAK character. If another baud rates specified
|
||||
then the original baud rate is also saved to the end of the wanted baud rates
|
||||
list. It allows to return to the original baud rate after unexpected BREAKs.
|
||||
.TP
|
||||
\-t, \-\-timeout \fItimeout\fP
|
||||
Terminate if no user name could be read within \fItimeout\fP seconds.
|
||||
|
|
|
@ -1279,9 +1279,17 @@ static void termio_init(struct options *op, struct termios *tp)
|
|||
ispeed = cfgetispeed(tp);
|
||||
ospeed = cfgetospeed(tp);
|
||||
|
||||
if (!ispeed) ispeed = TTYDEF_SPEED;
|
||||
if (!ospeed) ospeed = TTYDEF_SPEED;
|
||||
|
||||
/* Save also the original speed to array of the speeds to make
|
||||
* it possible to return the the original after unexpected BREAKs.
|
||||
*/
|
||||
if (op->numspeed)
|
||||
op->speeds[op->numspeed++] = ispeed ? ispeed :
|
||||
ospeed ? ospeed :
|
||||
TTYDEF_SPEED;
|
||||
if (!ispeed)
|
||||
ispeed = TTYDEF_SPEED;
|
||||
if (!ospeed)
|
||||
ospeed = TTYDEF_SPEED;
|
||||
} else {
|
||||
ospeed = ispeed = op->speeds[FIRST_SPEED];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue