From: Lennart Poettering Date: Wed, 22 Nov 2023 12:10:16 +0000 (+0100) Subject: terminal-util: drop ECHOPRT flag from TTY settings when resetting X-Git-Tag: v255-rc3~6^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d5b6c6e3781b0c48f819bdfe2548d44a6583ec41;p=thirdparty%2Fsystemd.git terminal-util: drop ECHOPRT flag from TTY settings when resetting Let's disable ECHOPRT for terminals we reset. The feature only really makes sense for hardcopy terminals and we sure as shit don't talk to one of those. It has the effect that when line editing is on and you hit backspace it outputs "\" followed by the removed character. This never makes sense on a TTY that can just erase the character. Hence turn of this flag. We have carried this flag along for about forever, but it doesn't really make sense. I guess we mostly tested the terminal reset stuff for output only, not for input. This change is in particular useful for tools such as "systemd-firstboot" which interactively ask questions on the console, and where line editing should really work. --- diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index c266fea8104..3355b749cc0 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -273,7 +273,7 @@ int reset_terminal_fd(int fd, bool switch_to_text) { termios.c_iflag |= ICRNL | IMAXBEL | IUTF8; termios.c_oflag |= ONLCR | OPOST; termios.c_cflag |= CREAD; - termios.c_lflag = ISIG | ICANON | IEXTEN | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOPRT | ECHOKE; + termios.c_lflag = ISIG | ICANON | IEXTEN | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE; termios.c_cc[VINTR] = 03; /* ^C */ termios.c_cc[VQUIT] = 034; /* ^\ */