From: Lennart Poettering Date: Wed, 26 Feb 2025 16:59:42 +0000 (+0100) Subject: unit: return a better error state for unit_get_unit_file_preset() if we have no fragm... X-Git-Tag: v258-rc1~966^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb16d391637c26c4391b88830f949e56a534bd14;p=thirdparty%2Fsystemd.git unit: return a better error state for unit_get_unit_file_preset() if we have no fragment path We'd previously return what was already set. Let's instead return a clear ENOEXEC in this case, to make clear what is going on: preset logic doesn't apply to units which lag a fragment path. --- diff --git a/src/core/unit.c b/src/core/unit.c index 21d57f73bcd..ae977536b8b 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -4173,12 +4173,12 @@ PresetAction unit_get_unit_file_preset(Unit *u) { assert(u); - if (u->unit_file_preset >= 0 || !u->fragment_path) + if (u->unit_file_preset >= 0) return u->unit_file_preset; /* If this is a transient or perpetual unit file it doesn't make much sense to ask the preset * database about this, because enabling/disabling makes no sense for either. Hence don't. */ - if (u->transient || u->perpetual) + if (!u->fragment_path || u->transient || u->perpetual) return (u->unit_file_preset = -ENOEXEC); _cleanup_free_ char *bn = NULL;