summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-08-06 21:41:54 +0200
committerSven Eden <sven.eden@prydeworx.com>2018-10-29 10:18:35 +0100
commit76539125582a999922632f4fb9718d7def8987c0 (patch)
treededd0cc8811150324be270268cef931a5c165264
parentd618a4a142ddad5e204c671dcf1109545fecd206 (diff)
logind: don't clobber bus error structure if we don't fail
(cherry picked from commit ea3a7cf6c34163834893f1f4c7af44c8245776ac)
-rw-r--r--src/login/logind-dbus.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 90861eab7..073bb02e8 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -3256,7 +3256,8 @@ int manager_stop_unit(Manager *manager, const char *unit, sd_bus_error *error, c
return strdup_job(reply, job);
}
-int manager_abandon_scope(Manager *manager, const char *scope, sd_bus_error *error) {
+int manager_abandon_scope(Manager *manager, const char *scope, sd_bus_error *ret_error) {
+ _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_free_ char *path = NULL;
int r;
@@ -3273,17 +3274,16 @@ int manager_abandon_scope(Manager *manager, const char *scope, sd_bus_error *err
path,
"org.freedesktop.systemd1.Scope",
"Abandon",
- error,
+ &error,
NULL,
NULL);
if (r < 0) {
- if (sd_bus_error_has_name(error, BUS_ERROR_NO_SUCH_UNIT) ||
- sd_bus_error_has_name(error, BUS_ERROR_LOAD_FAILED) ||
- sd_bus_error_has_name(error, BUS_ERROR_SCOPE_NOT_RUNNING)) {
- sd_bus_error_free(error);
+ if (sd_bus_error_has_name(&error, BUS_ERROR_NO_SUCH_UNIT) ||
+ sd_bus_error_has_name(&error, BUS_ERROR_LOAD_FAILED) ||
+ sd_bus_error_has_name(&error, BUS_ERROR_SCOPE_NOT_RUNNING))
return 0;
- }
+ sd_bus_error_move(ret_error, &error);
return r;
}