[systemd-devel] [PATCH] shared/install: avoid prematurely rejecting "missing" units

Dave Reisner dreisner at archlinux.org
Thu Oct 30 17:28:14 PDT 2014


f7101b7368df copied some logic to prevent enabling masked units, but
also added a check which causes attempts to enable templated units to
fail. Since we know the logic beyond this check will properly handle
units which truly do not exist, we can rely on the unit file state
comparison to suffice for expressing the intent of f7101b7368df.

ref: https://bugs.archlinux.org/task/42616
---
This seems to me like the right thing to do, but I'm not so familiar with
this code...

 src/shared/install.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/src/shared/install.c b/src/shared/install.c
index 035b44c..3ad5362 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1621,11 +1621,6 @@ int unit_file_enable(
                 UnitFileState state;
 
                 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;
-- 
2.1.3


More information about the systemd-devel mailing list