summaryrefslogtreecommitdiff
path: root/src/dbus1-generator
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-08-16 14:34:36 +0200
committerLennart Poettering <lennart@poettering.net>2015-08-16 14:34:36 +0200
commite59679246ef6faf4348e2055db80baa8dec380e5 (patch)
tree47220e36c65d9ecf706cb8fdc0b9b652f1fef421 /src/dbus1-generator
parentab5838fce7408061514b6322a39b1b5e27cc19b1 (diff)
parentd4d00020d6ad855d65d31020fefa5003e1bb477f (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.c9
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);
}
}