summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2020-03-17 18:30:58 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-03-26 14:08:30 +0100
commit8f0feac20f7d4c29a42839343308fcd602ec5b63 (patch)
tree5cd72106684ae8492dbb0d90ee32437303c2c73c
parenta0b4460e49d0bf537a4fc3db37d56aa04ef41c36 (diff)
downloadsystemd-8f0feac20f7d4c29a42839343308fcd602ec5b63.tar.gz
logind: log a more accurate error when we failed at session creation
We used to log the following error: "Start job for unit user-1000.slice failed with 'canceled'" which can be really misleading if the actual job failed at *stopping* a unit. Indeed "Start" was hard coded but it was wrong since we can also fail with stop jobs which are enqueued when a session is stopped. (cherry picked from commit b39648ed47065202b343d1d4bde3232d81fdfecc)
-rw-r--r--src/login/logind-dbus.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 52a7ea3c77..15201f900f 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -3424,7 +3424,7 @@ const sd_bus_vtable manager_vtable[] = {
SD_BUS_VTABLE_END
};
-static int session_jobs_reply(Session *s, const char *unit, const char *result) {
+static int session_jobs_reply(Session *s, uint32_t jid, const char *unit, const char *result) {
assert(s);
assert(unit);
@@ -3435,7 +3435,7 @@ static int session_jobs_reply(Session *s, const char *unit, const char *result)
_cleanup_(sd_bus_error_free) sd_bus_error e = SD_BUS_ERROR_NULL;
sd_bus_error_setf(&e, BUS_ERROR_JOB_FAILED,
- "Start job for unit '%s' failed with '%s'", unit, result);
+ "Job %u for unit '%s' failed with '%s'", jid, unit, result);
return session_send_create_reply(s, &e);
}
@@ -3475,7 +3475,7 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err
if (session) {
if (streq_ptr(path, session->scope_job)) {
session->scope_job = mfree(session->scope_job);
- (void) session_jobs_reply(session, unit, result);
+ (void) session_jobs_reply(session, id, unit, result);
session_save(session);
user_save(session->user);
@@ -3490,7 +3490,7 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err
user->service_job = mfree(user->service_job);
LIST_FOREACH(sessions_by_user, session, user->sessions)
- (void) session_jobs_reply(session, unit, NULL /* don't propagate user service failures to the client */);
+ (void) session_jobs_reply(session, id, unit, NULL /* don't propagate user service failures to the client */);
user_save(user);
}