|
|
ad9577 |
From 7974045302fe53629e70501f0180f30cbaa25b1e Mon Sep 17 00:00:00 2001
|
|
|
ad9577 |
From: Karel Zak <kzak@redhat.com>
|
|
|
ad9577 |
Date: Wed, 6 Jun 2018 15:57:24 +0200
|
|
|
ad9577 |
Subject: [PATCH 162/173] agetty: keep c_iflags unmodified on --autologin
|
|
|
ad9577 |
|
|
|
ad9577 |
agetty sets c_iflags according to interaction with serial line in
|
|
|
ad9577 |
get_logname(). For --autologin it does not read from the line, so we
|
|
|
ad9577 |
have no clue how to set the flags.
|
|
|
ad9577 |
|
|
|
ad9577 |
The current behavior is to zeroize the flags. Unfortunately, it seems
|
|
|
ad9577 |
like bad idea, because the line may be already properly initialized by
|
|
|
ad9577 |
kernel (or systemd, etc.).
|
|
|
ad9577 |
|
|
|
ad9577 |
The new behavior is not touch the flags on --autologin.
|
|
|
ad9577 |
|
|
|
ad9577 |
Upstream: http://github.com/karelzak/util-linux/commit/2c4d86abdadab19be76abecb156da7f7dc284d81
|
|
|
ad9577 |
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1252764
|
|
|
ad9577 |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
ad9577 |
---
|
|
|
ad9577 |
term-utils/agetty.8 | 4 ++++
|
|
|
ad9577 |
term-utils/agetty.c | 17 +++++++++++++----
|
|
|
ad9577 |
2 files changed, 17 insertions(+), 4 deletions(-)
|
|
|
ad9577 |
|
|
|
ad9577 |
diff --git a/term-utils/agetty.8 b/term-utils/agetty.8
|
|
|
ad9577 |
index a42cdf158..fe4bfd427 100644
|
|
|
ad9577 |
--- a/term-utils/agetty.8
|
|
|
ad9577 |
+++ b/term-utils/agetty.8
|
|
|
ad9577 |
@@ -94,6 +94,10 @@ password. The \-f \fIusername\fP option is added to the \fB/bin/login\fP
|
|
|
ad9577 |
command line by default. The \-\-login-options option changes this default
|
|
|
ad9577 |
behaviour and then only \\u is replaced by the \fIusername\fP and no other
|
|
|
ad9577 |
option is added to the login command line.
|
|
|
ad9577 |
+
|
|
|
ad9577 |
+Note that \fB\-\-autologin\fP may affect the way how agetty initializes the
|
|
|
ad9577 |
+serial line, because on auto-login agetty does not read from the line and it
|
|
|
ad9577 |
+has no opportunity optimize the line setting.
|
|
|
ad9577 |
.TP
|
|
|
ad9577 |
\-c, \-\-noreset
|
|
|
ad9577 |
Don't reset terminal cflags (control modes). See \fItermios(3)\fP for more
|
|
|
ad9577 |
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
|
|
|
ad9577 |
index b626cdbeb..948d77246 100644
|
|
|
ad9577 |
--- a/term-utils/agetty.c
|
|
|
ad9577 |
+++ b/term-utils/agetty.c
|
|
|
ad9577 |
@@ -1100,13 +1100,22 @@ static void termio_init(struct options *op, struct termios *tp)
|
|
|
ad9577 |
/* Flush input and output queues, important for modems! */
|
|
|
ad9577 |
tcflush(STDIN_FILENO, TCIOFLUSH);
|
|
|
ad9577 |
|
|
|
ad9577 |
+ /* The defaul is set c_iflag in termio_final() according to chardata.
|
|
|
ad9577 |
+ * Unfortunately, the chardata are not set according to the serial line
|
|
|
ad9577 |
+ * if --autolog is enabled. In this case we do not read from the line
|
|
|
ad9577 |
+ * at all. The best what we can do in this case is to keep c_iflag
|
|
|
ad9577 |
+ * unmodified for --autolog.
|
|
|
ad9577 |
+ */
|
|
|
ad9577 |
+ if (!op->autolog) {
|
|
|
ad9577 |
#ifdef IUTF8
|
|
|
ad9577 |
- tp->c_iflag = tp->c_iflag & IUTF8;
|
|
|
ad9577 |
- if (tp->c_iflag & IUTF8)
|
|
|
ad9577 |
- op->flags |= F_UTF8;
|
|
|
ad9577 |
+ tp->c_iflag = tp->c_iflag & IUTF8;
|
|
|
ad9577 |
+ if (tp->c_iflag & IUTF8)
|
|
|
ad9577 |
+ op->flags |= F_UTF8;
|
|
|
ad9577 |
#else
|
|
|
ad9577 |
- tp->c_iflag = 0;
|
|
|
ad9577 |
+ tp->c_iflag = 0;
|
|
|
ad9577 |
#endif
|
|
|
ad9577 |
+ }
|
|
|
ad9577 |
+
|
|
|
ad9577 |
tp->c_lflag = 0;
|
|
|
ad9577 |
tp->c_oflag &= OPOST | ONLCR;
|
|
|
ad9577 |
|
|
|
ad9577 |
--
|
|
|
ad9577 |
2.14.4
|
|
|
ad9577 |
|