diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-08-26 16:50:35 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-08-26 17:36:07 +0200 |
commit | b8643ee2eade949e544baed563935058e4f09a8c (patch) | |
tree | a5b708ac44ee5e75dd46847bc9a44a08e192c0fe /src/core | |
parent | cryptsetup: drop an unused variable (diff) | |
download | systemd-b8643ee2eade949e544baed563935058e4f09a8c.tar.xz systemd-b8643ee2eade949e544baed563935058e4f09a8c.zip |
Revert "core: Add information on which condition failed to job skipped format string"
This reverts commit c97bef458b6e59079c9613ec755c1c6513c1c655.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/job.c | 45 |
1 files changed, 11 insertions, 34 deletions
diff --git a/src/core/job.c b/src/core/job.c index b0396c5c05..dd16a0b280 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -571,7 +571,7 @@ static void job_emit_start_message(Unit *u, uint32_t job_id, JobType t) { } } -static char* job_done_message_format(Unit *u, JobType t, JobResult result) { +static const char* job_done_message_format(Unit *u, JobType t, JobResult result) { static const char* const generic_finished_start_job[_JOB_RESULT_MAX] = { [JOB_DONE] = "Started %s.", [JOB_TIMEOUT] = "Timed out starting %s.", @@ -605,59 +605,36 @@ static char* job_done_message_format(Unit *u, JobType t, JobResult result) { assert(t < _JOB_TYPE_MAX); /* Show condition check message if the job did not actually do anything due to failed condition. */ - if (t == JOB_START && result == JOB_DONE && !u->condition_result) { - Condition *c; - - LIST_FOREACH(conditions, c, u->conditions) - if (c->result != CONDITION_SUCCEEDED) - break; - - if (!c) - return strdup("%s was skipped because of a failed condition check."); - - return strjoin( - "%s was skipped because of a failed condition check: ", - condition_type_to_string(c->type), - "=", - c->trigger ? "|" : "", - c->negate ? "!" : "", - c->parameter, - "."); - } + if (t == JOB_START && result == JOB_DONE && !u->condition_result) + return "Condition check resulted in %s being skipped."; if (IN_SET(t, JOB_START, JOB_STOP, JOB_RESTART)) { const UnitStatusMessageFormats *formats = &UNIT_VTABLE(u)->status_message_formats; if (formats->finished_job) { format = formats->finished_job(u, t, result); if (format) - return strdup(format); + return format; } format = (t == JOB_START ? formats->finished_start_job : formats->finished_stop_job)[result]; if (format) - return strdup(format); + return format; } /* Return generic strings */ switch (t) { case JOB_START: - format = generic_finished_start_job[result]; - break; + return generic_finished_start_job[result]; case JOB_STOP: case JOB_RESTART: - format = generic_finished_stop_job[result]; - break; + return generic_finished_stop_job[result]; case JOB_RELOAD: - format = generic_finished_reload_job[result]; - break; + return generic_finished_reload_job[result]; case JOB_VERIFY_ACTIVE: - format = generic_finished_verify_active_job[result]; - break; + return generic_finished_verify_active_job[result]; default: return NULL; } - - return format ? strdup(format) : NULL; } static const struct { @@ -698,8 +675,8 @@ static const char* job_done_mid(JobType type, JobResult result) { } static void job_emit_done_message(Unit *u, uint32_t job_id, JobType t, JobResult result) { - _cleanup_free_ char *free_ident = NULL, *format = NULL; - const char *ident; + _cleanup_free_ char *free_ident = NULL; + const char *ident, *format; assert(u); assert(t >= 0); |