From: Lennart Poettering Date: Fri, 24 Apr 2026 13:19:06 +0000 (+0200) Subject: job: properly initialize all enum fields X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=143126cbcd1511dec8e241ca47f48bdf20a0f3dd;p=thirdparty%2Fsystemd.git job: properly initialize all enum fields This changes the .result field to invalid initially, which arguably makes more sense than "done", which was previously the default. This is a correctnes fix, and afaics has no effect on the API, since we do not expose this 1:1 as D-Bus property: it's only seen on D-Bus as part of the job completion signal, at which part it is correctly initialized. Noticed while reviewing: https://github.com/systemd/systemd/pull/41583 --- diff --git a/src/core/job.c b/src/core/job.c index 7dd8a4617db..920d246b884 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -41,6 +41,8 @@ Job* job_new_raw(Unit *unit) { .manager = unit->manager, .unit = unit, .type = _JOB_TYPE_INVALID, + .state = JOB_WAITING, + .result = _JOB_RESULT_INVALID, }; return j; diff --git a/src/core/job.h b/src/core/job.h index d8aa6ce17c5..ff1d25ff502 100644 --- a/src/core/job.h +++ b/src/core/job.h @@ -106,7 +106,6 @@ typedef struct Job { JobType type; JobState state; - JobResult result; unsigned run_queue_idx;