summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/shared/install.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index 035b44cc52..cab93e8dc6 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1620,12 +1620,10 @@ int unit_file_enable(
STRV_FOREACH(i, files) {
UnitFileState state;
+ /* We only want to know if this unit is masked, so we ignore
+ * errors from unit_file_get_state, deferring other checks.
+ * This allows templated units to be enabled on the fly. */
state = unit_file_get_state(scope, root_dir, *i);
- if (state < 0) {
- log_error("Failed to get unit file state for %s: %s", *i, strerror(-state));
- return state;
- }
-
if (state == UNIT_FILE_MASKED || state == UNIT_FILE_MASKED_RUNTIME) {
log_error("Failed to enable unit: Unit %s is masked", *i);
return -ENOTSUP;