summaryrefslogtreecommitdiff
path: root/src/login/logind-user.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-01-12 22:02:18 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-01-18 15:21:28 -0500
commit2adae5ac5dd87cc6426ae0aa22116f20abc6646f (patch)
tree4234b1d0b44729a114fa3f535f784bb9ce611c6a /src/login/logind-user.c
parent011062f3c0cff25f60fa15eca8a20b8e47d7db72 (diff)
logind: simplify job variable handling
manager_{start,stop}_{slice,scope,unit} functions had an optional job output parameter. But all callers specified job, so make the parameter mandatory, add asserts. Also extract common job variable handling to a helper function to avoid duplication. Avoids gcc warning about job being unitialized.
Diffstat (limited to 'src/login/logind-user.c')
-rw-r--r--src/login/logind-user.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index a8366f0231..98f8ea3c78 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -412,13 +412,12 @@ static int user_start_slice(User *u) {
u->manager->user_tasks_max,
&error,
&job);
- if (r < 0) {
- /* we don't fail due to this, let's try to continue */
- if (!sd_bus_error_has_name(&error, BUS_ERROR_UNIT_EXISTS))
- log_error_errno(r, "Failed to start user slice %s, ignoring: %s (%s)", u->slice, bus_error_message(&error, r), error.name);
- } else {
+ if (r >= 0)
u->slice_job = job;
- }
+ else if (!sd_bus_error_has_name(&error, BUS_ERROR_UNIT_EXISTS))
+ /* we don't fail due to this, let's try to continue */
+ log_error_errno(r, "Failed to start user slice %s, ignoring: %s (%s)",
+ u->slice, bus_error_message(&error, r), error.name);
return 0;
}