summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-08-06 21:41:54 +0200
committerLennart Poettering <lennart@poettering.net>2018-10-13 12:59:29 +0200
commitea3a7cf6c34163834893f1f4c7af44c8245776ac (patch)
tree212df1c52a124e9d75a3e891eeed25f3226466d5 /src/login
parente6958b7ea33813b085966ac25817a957c0dad7f9 (diff)
downloadsystemd-ea3a7cf6c34163834893f1f4c7af44c8245776ac.tar.gz
systemd-ea3a7cf6c34163834893f1f4c7af44c8245776ac.tar.bz2
systemd-ea3a7cf6c34163834893f1f4c7af44c8245776ac.zip
logind: don't clobber bus error structure if we don't fail
Diffstat (limited to 'src/login')
-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 2e7eb343f1..599c473d3d 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -3081,7 +3081,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;
@@ -3098,17 +3099,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;
}