summaryrefslogtreecommitdiff
path: root/src/bus-driverd/bus-driverd.c
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2014-01-07 20:20:22 +0800
committerKay Sievers <kay@vrfy.org>2014-01-08 08:38:39 +0800
commit54142c6af15c24a72a1b8dcf278dbe97b95e541a (patch)
treeb76a63c7adbb0e4b63df0755a020ea57f69b8956 /src/bus-driverd/bus-driverd.c
parent7ca7b61f70371493a0539a76108dd84e0f765264 (diff)
bus-driverd: support user mode
Diffstat (limited to 'src/bus-driverd/bus-driverd.c')
-rw-r--r--src/bus-driverd/bus-driverd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/bus-driverd/bus-driverd.c b/src/bus-driverd/bus-driverd.c
index 44172c4ed6..172ad68c43 100644
--- a/src/bus-driverd/bus-driverd.c
+++ b/src/bus-driverd/bus-driverd.c
@@ -51,6 +51,7 @@
#include "def.h"
#include "unit-name.h"
#include "bus-control.h"
+#include "cgroup-util.h"
#define CLIENTS_MAX 1024
#define MATCHES_MAX 1024
@@ -748,7 +749,11 @@ static int connect_bus(Context *c) {
assert(c);
- r = sd_bus_default_system(&c->bus);
+ r = cg_pid_get_owner_uid(0, NULL);
+ if (r < 0)
+ r = sd_bus_default_system(&c->bus);
+ else
+ r = sd_bus_default_user(&c->bus);
if (r < 0) {
log_error("Failed to create bus: %s", strerror(-r));
return r;
@@ -828,5 +833,4 @@ finish:
sd_event_unref(context.event);
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
-
}