]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
agetty: keep c_iflags unmodified on --autologin
authorKarel Zak <kzak@redhat.com>
Wed, 6 Jun 2018 13:57:24 +0000 (15:57 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 6 Jun 2018 13:57:24 +0000 (15:57 +0200)
agetty sets c_iflags according to interaction with serial line in
get_logname(). For --autologin it does not read from the line, so we
have no clue how to set the flags.

The current behavior is to zeroize the flags.  Unfortunately, it seems
like bad idea, because the line may be already properly initialized by
kernel (or systemd, etc.).

The new behavior is not touch the flags on --autologin.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1252764
Signed-off-by: Karel Zak <kzak@redhat.com>
term-utils/agetty.8
term-utils/agetty.c

index fcb1fd5fec0aea77e6ce4a22c0b002c1fc207281..5a480808d8704d84f15647ceaa13d481498bd59d 100644 (file)
@@ -93,6 +93,10 @@ Automatically log in the specified user without asking for a username or passwor
 Using this option causes an \fB\-f \fIusername\fR option and argument to be
 added to the \fB/bin/login\fP command line.  See \fB\-\-login\-options\fR, which
 can be used to modify this option's behavior.
+
+Note that \fB\-\-autologin\fP may affect the way how agetty initializes the
+serial line, because on auto-login agetty does not read from the line and it
+has no opportunity optimize the line setting.
 .TP
 \-c, \-\-noreset
 Do not reset terminal cflags (control modes).  See \fBtermios\fP(3) for more
index 84422040128859d032e6699dd770090a3cf534e2..e22600e2858473f7a3fe319ed943c05ff14dbefd 100644 (file)
@@ -1264,13 +1264,22 @@ static void termio_init(struct options *op, struct termios *tp)
         * later on.
         */
 
+       /* The defaul is set c_iflag in termio_final() according to chardata.
+        * Unfortunately, the chardata are not set according to the serial line
+        * if --autolog is enabled. In this case we do not read from the line
+        * at all. The best what we can do in this case is to keep c_iflag
+        * unmodified for --autolog.
+        */
+       if (!op->autolog) {
 #ifdef IUTF8
-       tp->c_iflag = tp->c_iflag & IUTF8;
-       if (tp->c_iflag & IUTF8)
-               op->flags |= F_UTF8;
+               tp->c_iflag = tp->c_iflag & IUTF8;
+               if (tp->c_iflag & IUTF8)
+                       op->flags |= F_UTF8;
 #else
-       tp->c_iflag = 0;
+               tp->c_iflag = 0;
 #endif
+       }
+
        tp->c_lflag = 0;
        tp->c_oflag &= OPOST | ONLCR;