summaryrefslogtreecommitdiff
path: root/src/libelogind/sd-bus/sd-bus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-12-19 15:41:58 +0100
committerSven Eden <yamakuzure@gmx.net>2018-05-30 07:49:59 +0200
commit20b20d0c3c2109840a83f435818d033dbe027a14 (patch)
treecea99d3ddddd492f5085a903310be1ff69ea2fb9 /src/libelogind/sd-bus/sd-bus.c
parent22130b6b3c6d060b405bbc17d9a6a670001358ab (diff)
sd-bus: drop references to legacy /var/run D-Bus socket
Let's directly reference /run instead, so that we can work without /var being around, or with /var/run being incorrectly set up. Note that we keep the old socket path in place when referencing the system bus of containers, as they might be foreign operating systems, that still don't have adopted /run, and where it makes sense to use the standardized name instead. On local systems, we insist on /run being set up properly however, hence this limitation does not apply. Also, get rid of the UNIX_SYSTEM_BUS_ADDRESS and UNIX_USER_BUS_ADDRESS_FMT defines. They had a purpose when we still did kdbus, as we then had to support two different backends. But since that's gone, we don't need this indirection anymore, hence settle on a one define only.
Diffstat (limited to 'src/libelogind/sd-bus/sd-bus.c')
-rw-r--r--src/libelogind/sd-bus/sd-bus.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libelogind/sd-bus/sd-bus.c b/src/libelogind/sd-bus/sd-bus.c
index 5f99d0f8a..5976e6d28 100644
--- a/src/libelogind/sd-bus/sd-bus.c
+++ b/src/libelogind/sd-bus/sd-bus.c
@@ -837,6 +837,7 @@ static int parse_container_unix_address(sd_bus *b, const char **p, char **guid)
b->nspid = 0;
b->sockaddr.un.sun_family = AF_UNIX;
+ /* Note that we use the old /var/run prefix here, to increase compatibility with really old containers */
strncpy(b->sockaddr.un.sun_path, "/var/run/dbus/system_bus_socket", sizeof(b->sockaddr.un.sun_path));
b->sockaddr_size = SOCKADDR_UN_LEN(b->sockaddr.un);
b->is_local = false;
@@ -1167,7 +1168,7 @@ int bus_set_address_user(sd_bus *b) {
if (!ee)
return -ENOMEM;
- if (asprintf(&s, UNIX_USER_BUS_ADDRESS_FMT, ee) < 0)
+ if (asprintf(&s, DEFAULT_USER_BUS_ADDRESS_FMT, ee) < 0)
return -ENOMEM;
b->address = s;