mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-05 00:37:59 +02:00
dbus-launch: if using X to define the session lifetime, do not poll stdin
dbus-launch --exit-with-session attempts to scope the session length to various things: - if DISPLAY points to an X server, exit when the X session ends - if stdin is a terminal, exit when end-of-file is reached - if both are true, exit when one of them happens, whichever is first - if neither is true, fail These are not particularly useful semantics: if the session is scoped to the X session, then the terminal from which dbus-launch was launched is irrelevant. This also causes practical problems when dbus-launch consumes characters from the terminal from which it happens to have been launched (some display managers, like slim and nodm, run users' X sessions with stdin pointing to the terminal from which the init daemon happens to have started the display manager during boot, usually tty1 on Linux). Reviewed-by: Will Thompson <will.thompson@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39197
This commit is contained in:
parent
ab0cebd883
commit
1785b37e43
1 changed files with 13 additions and 4 deletions
|
|
@ -492,11 +492,20 @@ kill_bus_when_session_ends (void)
|
|||
else
|
||||
tty_fd = -1;
|
||||
|
||||
if (tty_fd >= 0)
|
||||
verbose ("stdin isatty(), monitoring it\n");
|
||||
if (x_fd >= 0)
|
||||
{
|
||||
verbose ("session lifetime is defined by X, not monitoring stdin\n");
|
||||
tty_fd = -1;
|
||||
}
|
||||
else if (tty_fd >= 0)
|
||||
{
|
||||
verbose ("stdin isatty(), monitoring it\n");
|
||||
}
|
||||
else
|
||||
verbose ("stdin was not a TTY, not monitoring it\n");
|
||||
|
||||
{
|
||||
verbose ("stdin was not a TTY, not monitoring it\n");
|
||||
}
|
||||
|
||||
if (tty_fd < 0 && x_fd < 0)
|
||||
{
|
||||
fprintf (stderr, "No terminal on standard input and no X display; cannot attach message bus to session lifetime\n");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue