diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-08-16 14:34:36 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-08-16 14:34:36 +0200 |
commit | e59679246ef6faf4348e2055db80baa8dec380e5 (patch) | |
tree | 47220e36c65d9ecf706cb8fdc0b9b652f1fef421 /src/dbus1-generator | |
parent | ab5838fce7408061514b6322a39b1b5e27cc19b1 (diff) | |
parent | d4d00020d6ad855d65d31020fefa5003e1bb477f (diff) |
Merge pull request #932 from kaysievers/bus
sd-bus: do not connect to dbus-1 socket when kdbus is available
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); } } |