summaryrefslogtreecommitdiff
path: root/src/login/logind-dbus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-08-06 19:00:49 +0200
committerSven Eden <sven.eden@prydeworx.com>2018-10-29 10:18:34 +0100
commitd1f2956082e945c96fb74ec19a3302763d209325 (patch)
tree8fbeba61983a85e93183f0ed1fc249dedee03a14 /src/login/logind-dbus.c
parent882fa3df6c9720f0eb32e54ec812d38e9cc683ef (diff)
logind: make unit/job active checking more debuggable
Let's log the error messages if we get any at debug level. (cherry picked from commit bd26aee1f6bea13fe25b3feb2a5e9cd1be522e7e)
Diffstat (limited to 'src/login/logind-dbus.c')
-rw-r--r--src/login/logind-dbus.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 1da47300b..90861eab7 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -3305,7 +3305,7 @@ int manager_kill_unit(Manager *manager, const char *unit, KillWho who, int signo
"ssi", unit, who == KILL_LEADER ? "main" : "all", signo);
}
-int manager_unit_is_active(Manager *manager, const char *unit) {
+int manager_unit_is_active(Manager *manager, const char *unit, sd_bus_error *ret_error) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
_cleanup_free_ char *path = NULL;
@@ -3341,17 +3341,18 @@ int manager_unit_is_active(Manager *manager, const char *unit) {
sd_bus_error_has_name(&error, BUS_ERROR_LOAD_FAILED))
return false;
+ sd_bus_error_move(ret_error, &error);
return r;
}
r = sd_bus_message_read(reply, "s", &state);
if (r < 0)
- return -EINVAL;
+ return r;
- return !streq(state, "inactive") && !streq(state, "failed");
+ return !STR_IN_SET(state, "inactive", "failed");
}
-int manager_job_is_active(Manager *manager, const char *path) {
+int manager_job_is_active(Manager *manager, const char *path, sd_bus_error *ret_error) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
int r;
@@ -3376,6 +3377,7 @@ int manager_job_is_active(Manager *manager, const char *path) {
if (sd_bus_error_has_name(&error, SD_BUS_ERROR_UNKNOWN_OBJECT))
return false;
+ sd_bus_error_move(ret_error, &error);
return r;
}