aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-03-16 09:21:40 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2017-03-17 13:01:40 +0100
commita1ae7c362b0b7a65cad813a8def6c8eae72f33b2 (patch)
treeeb5813a85f5fb660d230622bb5a6a97758caf50b
parenta3afdbb58800ea2b559585e321d4a18ed33c4655 (diff)
Use the same dbus connection
Opening one connection per part of the program doesn't make sense and waste resources. Using a common one is much better. Change-Id: I74dc3cd7ae41d7bfa2f03f4a252495e8f5f81578 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afm-user-daemon.c2
-rw-r--r--src/utils-systemd.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/afm-user-daemon.c b/src/afm-user-daemon.c
index f9d74e9..a180be6 100644
--- a/src/afm-user-daemon.c
+++ b/src/afm-user-daemon.c
@@ -451,7 +451,7 @@ static int open_bus(sd_bus **ret, int isuser, const char *address)
int rc;
if (address == NULL)
- return (isuser ? sd_bus_open_user : sd_bus_open_system)(ret);
+ return (isuser ? sd_bus_default_user : sd_bus_default_system)(ret);
rc = sd_bus_new(&b);
if (rc < 0)
diff --git a/src/utils-systemd.c b/src/utils-systemd.c
index 48fb3d8..62930ed 100644
--- a/src/utils-systemd.c
+++ b/src/utils-systemd.c
@@ -51,11 +51,11 @@ static int get_bus(int isuser, struct sd_bus **ret)
*ret = bus;
rc = 0;
} else if (isuser) {
- rc = sd_bus_open_user(ret);
+ rc = sd_bus_default_user(ret);
if (!rc)
usrbus = *ret;
} else {
- rc = sd_bus_open_system(ret);
+ rc = sd_bus_default_system(ret);
if (!rc)
sysbus = *ret;
}