summaryrefslogtreecommitdiffstats
path: root/src/core/main.c
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2023-07-13 14:50:23 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2023-07-14 09:11:29 +0200
commit29f5a5aef013133cfa0a60f842b434a397234d4b (patch)
tree1b38b3130fb3278fc3455694f4fab908a3ba3aea /src/core/main.c
parentdocs: fix order (diff)
downloadsystemd-29f5a5aef013133cfa0a60f842b434a397234d4b.tar.xz
systemd-29f5a5aef013133cfa0a60f842b434a397234d4b.zip
tree-wide: Set /dev/console size when we reset it
If a size is configured for /dev/console via the kernel cmdline, let's make sure we take that into account when resetting /dev/console.
Diffstat (limited to 'src/core/main.c')
-rw-r--r--src/core/main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/main.c b/src/core/main.c
index f9fd9fae7c..bbbf77a779 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -220,6 +220,7 @@ static int manager_find_user_config_paths(char ***ret_files, char ***ret_dirs) {
static int console_setup(void) {
_cleanup_close_ int tty_fd = -EBADF;
+ unsigned rows, cols;
int r;
tty_fd = open_terminal("/dev/console", O_WRONLY|O_NOCTTY|O_CLOEXEC);
@@ -232,6 +233,15 @@ static int console_setup(void) {
if (r < 0)
return log_error_errno(r, "Failed to reset /dev/console: %m");
+ r = proc_cmdline_tty_size("/dev/console", &rows, &cols);
+ if (r < 0)
+ log_warning_errno(r, "Failed to get terminal size, ignoring: %m");
+ else {
+ r = terminal_set_size_fd(tty_fd, NULL, rows, cols);
+ if (r < 0)
+ log_warning_errno(r, "Failed to set terminal size, ignoring: %m");
+ }
+
return 0;
}