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