]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
unit: initialize unit_file_preset field to valid value
authorLennart Poettering <lennart@poettering.net>
Wed, 26 Feb 2025 16:57:19 +0000 (17:57 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 1 Apr 2025 14:44:21 +0000 (16:44 +0200)
"-1" is not a valid enum value. Use a better one. All code using this
considers negative values error codes anyway, hence the old code was
just a weird way to write -EPERM. Let's clean this up.

src/core/unit.c

index 476c5332da9be42b9809007da2d28a4e4469da95..21d57f73bcdea5263f58bd5251b645e6998df232 100644 (file)
@@ -107,7 +107,7 @@ Unit* unit_new(Manager *m, size_t size) {
         u->type = _UNIT_TYPE_INVALID;
         u->default_dependencies = true;
         u->unit_file_state = _UNIT_FILE_STATE_INVALID;
-        u->unit_file_preset = -1;
+        u->unit_file_preset = _PRESET_ACTION_INVALID;
         u->on_failure_job_mode = JOB_REPLACE;
         u->on_success_job_mode = JOB_FAIL;
         u->job_timeout = USEC_INFINITY;