]> git.ipfire.org Git - thirdparty/systemd.git/commit
basic/terminal-util: operate on one fd in get_default_background_color()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 20 Nov 2025 13:33:26 +0000 (14:33 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 24 Nov 2025 20:47:57 +0000 (21:47 +0100)
commit46f6742911ba70ad19cc94da241dc4ff7b1c7489
treee322dfc7a6929b9996a77433577b9de05a09ee98
parent933c6900308fe321b8f7aa765df293969d81e399
basic/terminal-util: operate on one fd in get_default_background_color()

This moves the open call earlier, so that we do any state-changing operations
if we actually managed to open the nonblocking fd. The code is easier to follow
this way and might be more robust.

Suprisingly, this fixes https://github.com/systemd/systemd/issues/39055: it
seems that run0 chowns /dev/stdin (in my case /dev/pts/0) to root:root, and the
second run0 can read and write stdin/stdout throught the already-open fds,
but fd_reopen fails.

Fixes https://github.com/systemd/systemd/issues/39055.
src/basic/terminal-util.c