[PATCH 1/2] getty: keep IUTF8

Timo Teräs timo.teras at iki.fi
Wed May 4 16:52:48 UTC 2022


IUTF8 is needed to handle line editing correctly in utf-8 mode.
On virtual terminals kernel sets this flag automatically if utf8
mode is active (the default).

This is also what util-linux agetty does.

Signed-off-by: Timo Teräs <timo.teras at iki.fi>
---
 loginutils/getty.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/loginutils/getty.c b/loginutils/getty.c
index cd6378d80..890826a57 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -49,6 +49,9 @@
 #ifndef IUCLC
 # define IUCLC 0
 #endif
+#ifndef IUTF8
+# define IUTF8 0
+#endif
 
 #ifndef LOGIN_PROCESS
 # undef ENABLE_FEATURE_UTMP
@@ -310,7 +313,7 @@ static void init_tty_attrs(int speed)
 	if (option_mask32 & F_RTSCTS)
 		G.tty_attrs.c_cflag |= CRTSCTS; /* flow control using RTS/CTS pins */
 #endif
-	G.tty_attrs.c_iflag = 0;
+	G.tty_attrs.c_iflag &= IUTF8;
 	G.tty_attrs.c_lflag = 0;
 	/* non-raw output; add CR to each NL */
 	G.tty_attrs.c_oflag = OPOST | ONLCR;
-- 
2.36.0



More information about the busybox mailing list