core: Limit terminal reset using ANSI sequences to /dev/console
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 22 Apr 2024 20:58:49 +0000 (22:58 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 23 Apr 2024 13:05:50 +0000 (15:05 +0200)
commit00bc83a275fa3ca8d90579fe9597d8b651d47332
treea11f3a72b6184c29c96cb8fe2a932c0ea9a252ce
parent1b47cfab7f34c7c4a49d3320080398c206bc7f82
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.
src/basic/terminal-util.c
src/basic/terminal-util.h
src/core/main.c