core: Limit terminal reset using ANSI sequences to /dev/console

Doing this in reset_terminal_fd() is a bit too invasive, see
https://github.com/systemd/systemd/pull/32406#issuecomment-2070923583.

Let's only do this for /dev/console so that we work around weird firmwares
disabling line-wrapping, but avoid messing too much with other things.

While we're at it, let's handle more than just line wrapping, and do a
more general reset of stuff to get the terminal into a sane state.
This commit is contained in:
Daan De Meyer
2024-04-23 15:05:50 +02:00
committed by Zbigniew Jędrzejewski-Szmek
parent 1b47cfab7f
commit 00bc83a275
3 changed files with 39 additions and 23 deletions
+1
View File
@@ -98,6 +98,7 @@ bool isatty_safe(int fd);
int reset_terminal_fd(int fd, bool switch_to_text);
int reset_terminal(const char *name);
int set_terminal_cursor_position(int fd, unsigned int row, unsigned int column);
int terminal_reset_ansi_seq(int fd);
int open_terminal(const char *name, int mode);