diff options
author | Kay Sievers <kay@vrfy.org> | 2015-08-11 20:46:05 +0200 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2015-08-11 20:49:36 +0200 |
commit | d4d00020d6ad855d65d31020fefa5003e1bb477f (patch) | |
tree | 312c253adaf27c87c111d20a116df40a6496e468 /src/dbus1-generator | |
parent | 3f1818cf70ac34cf93f1f033b4f1bbb7a89b3dff (diff) |
sd-bus: do not connect to dbus-1 socket when kdbus is available
We should not fall back to dbus-1 and connect to the proxy when kdbus
returns an error that indicates that kdbus is running but just does not
accept new connections because of quota limits or something similar.
Using is_kdbus_available() in libsystemd/ requires it to move from
shared/ to libsystemd/.
Based on a patch from David Herrmann:
https://github.com/systemd/systemd/pull/886
Diffstat (limited to 'src/dbus1-generator')
-rw-r--r-- | src/dbus1-generator/dbus1-generator.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dbus1-generator/dbus1-generator.c b/src/dbus1-generator/dbus1-generator.c index 4980fccc31..25c8e209fd 100644 --- a/src/dbus1-generator/dbus1-generator.c +++ b/src/dbus1-generator/dbus1-generator.c @@ -84,7 +84,8 @@ static int create_dbus_files( fprintf(f, "Environment=DBUS_STARTER_BUS_TYPE=%s\n", type); if (streq(type, "system")) - fprintf(f, "Environment=DBUS_STARTER_ADDRESS=" DEFAULT_SYSTEM_BUS_ADDRESS "\n"); + fprintf(f, "Environment=DBUS_STARTER_ADDRESS=%s\n", + is_kdbus_available() ? KERNEL_SYSTEM_BUS_ADDRESS : UNIX_SYSTEM_BUS_ADDRESS); else if (streq(type, "session")) { char *run; @@ -94,8 +95,10 @@ static int create_dbus_files( return -EINVAL; } - fprintf(f, "Environment=DBUS_STARTER_ADDRESS="KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT "\n", - getuid(), run); + if (is_kdbus_available()) + fprintf(f, "Environment=DBUS_STARTER_ADDRESS="KERNEL_USER_BUS_ADDRESS_FMT "\n", getuid()); + else + fprintf(f, "Environment=DBUS_STARTER_ADDRESS="UNIX_USER_BUS_ADDRESS_FMT "\n", run); } } |