tree-wide: acquire /dev/console lock around any attempts to reset TTY

This commit is contained in:
Lennart Poettering
2024-07-19 11:44:04 +02:00
parent dffbe1d152
commit 2cd19499a0
6 changed files with 22 additions and 3 deletions
+4
View File
@@ -660,6 +660,10 @@ static int setup_confirm_stdio(
if (fd < 0)
return fd;
_cleanup_close_ int lock_fd = lock_dev_console();
if (lock_fd < 0)
log_debug_errno(lock_fd, "Failed to lock /dev/console, ignoring: %m");
r = chown_terminal(fd, getuid());
if (r < 0)
return r;