aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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",