diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2019-03-04 18:48:51 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-03-04 18:48:51 +0100 |
commit | 508184ab17922de7d5f02d2552b3c5f17eef60cc (patch) | |
tree | 72d6ada5869ae37421caa858596783f466685cd6 | |
parent | 446ead14577cf943459b5d29dee88a3b8c26abcc (diff) | |
download | fbida-508184ab17922de7d5f02d2552b3c5f17eef60cc.tar.gz |
add dbus checks
-rw-r--r-- | logind.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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", |