Skip to content

Commit cb16d39

Browse files
committed
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.
1 parent 7cb7f8b commit cb16d39

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/unit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4173,12 +4173,12 @@ PresetAction unit_get_unit_file_preset(Unit *u) {
41734173

41744174
assert(u);
41754175

4176-
if (u->unit_file_preset >= 0 || !u->fragment_path)
4176+
if (u->unit_file_preset >= 0)
41774177
return u->unit_file_preset;
41784178

41794179
/* If this is a transient or perpetual unit file it doesn't make much sense to ask the preset
41804180
* database about this, because enabling/disabling makes no sense for either. Hence don't. */
4181-
if (u->transient || u->perpetual)
4181+
if (!u->fragment_path || u->transient || u->perpetual)
41824182
return (u->unit_file_preset = -ENOEXEC);
41834183

41844184
_cleanup_free_ char *bn = NULL;

0 commit comments

Comments
 (0)