]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: when we want to know whether there's a native unit file, don't choke on... 2973/head
authorLennart Poettering <lennart@poettering.net>
Tue, 12 Apr 2016 14:13:28 +0000 (16:13 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 12 Apr 2016 14:19:57 +0000 (16:19 +0200)
ELOOP indicates that there's a symlink in /etc for a native unit file, and
that's completely OK.

src/systemctl/systemctl.c
src/sysv-generator/sysv-generator.c

index 9efdc63dde71f6f0818f70e56bd9af75d6231934..f0e788a5085ceb192879cab2406e088bec9ce90a 100644 (file)
@@ -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 */
index cae920eb3bf37b601103d66709bbcb66bb5866a8..9392a3d2b56d23f0568e2bc6ea9b28c7a7c0f6b6 100644 (file)
@@ -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;
                         }