aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-03-04 18:48:51 +0100
committerGerd Hoffmann <kraxel@redhat.com>2019-03-04 18:48:51 +0100
commit508184ab17922de7d5f02d2552b3c5f17eef60cc (patch)
tree72d6ada5869ae37421caa858596783f466685cd6
parent446ead14577cf943459b5d29dee88a3b8c26abcc (diff)
downloadfbida-508184ab17922de7d5f02d2552b3c5f17eef60cc.tar.gz
add dbus checks
-rw-r--r--logind.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/logind.c b/logind.c
index 6388df1..a2e9add 100644
--- a/logind.c
+++ b/logind.c
@@ -48,6 +48,8 @@ int logind_init(void)
int logind_dbus_fd(void)
{
+ if (!logind_dbus)
+ return -1;
return sd_bus_get_fd(logind_dbus);
}
@@ -56,6 +58,9 @@ void logind_dbus_input(void)
sd_bus_message *m = NULL;
int ret;
+ if (!logind_dbus)
+ return;
+
do {
ret = sd_bus_process(logind_dbus, &m);
fprintf(stderr, "%s: path %s\n", __func__,
@@ -70,6 +75,9 @@ int logind_take_control(void)
sd_bus_message *m = NULL;
int r;
+ if (!logind_dbus)
+ return -1;
+
r = sd_bus_call_method(logind_dbus,
"org.freedesktop.login1",
"/org/freedesktop/login1/session/self",
@@ -94,6 +102,9 @@ int logind_release_control(void)
sd_bus_message *m = NULL;
int r;
+ if (!logind_dbus)
+ return -1;
+
r = sd_bus_call_method(logind_dbus,
"org.freedesktop.login1",
"/org/freedesktop/login1/session/self",