summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/systemctl/systemctl.c4
-rw-r--r--src/sysv-generator/sysv-generator.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 9efdc63dde..f0e788a508 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -5272,9 +5272,9 @@ static int enable_sysv_units(const char *verb, char **args) {
continue;
j = unit_file_exists(arg_scope, &paths, name);
- if (j < 0)
+ if (j < 0 && !IN_SET(j, -ELOOP, -ESHUTDOWN, -EADDRNOTAVAIL))
return log_error_errno(j, "Failed to lookup unit file state: %m");
- found_native = j > 0;
+ found_native = j != 0;
/* If we have both a native unit and a SysV script, enable/disable them both (below); for is-enabled,
* prefer the native unit */
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index cae920eb3b..9392a3d2b5 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -807,10 +807,10 @@ static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) {
continue;
r = unit_file_exists(UNIT_FILE_SYSTEM, lp, name);
- if (r < 0) {
+ if (r < 0 && !IN_SET(r, -ELOOP, -ESHUTDOWN, -EADDRNOTAVAIL)) {
log_debug_errno(r, "Failed to detect whether %s exists, skipping: %m", name);
continue;
- } else if (r > 0) {
+ } else if (r != 0) {
log_debug("Native unit for %s already exists, skipping.", name);
continue;
}