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
This commit is contained in:
Lennart Poettering
2026-04-24 16:38:33 +01:00
committed by Luca Boccassi
parent 59e78701ec
commit 143126cbcd
2 changed files with 2 additions and 1 deletions
+2
View File
@@ -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;
-1
View File
@@ -106,7 +106,6 @@ typedef struct Job {
JobType type;
JobState state;
JobResult result;
unsigned run_queue_idx;