chiark / gitweb /
systemctl: fix 'is-enabled' for native units under /lib
authorMichal Schmidt <mschmidt@redhat.com>
Mon, 13 Jun 2011 12:19:47 +0000 (14:19 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 14 Jun 2011 19:58:29 +0000 (21:58 +0200)
The units always showed up as enabled.

The config file has to be parsed before we can check what's in
the [Install] section.

https://bugzilla.redhat.com/show_bug.cgi?id=699027

src/systemctl.c

index faca7975653d919c1c8e964fa6b0740d4aa12727..889e3ee0641fb47e058d500612897974b6286ace 100644 (file)
@@ -4160,6 +4160,13 @@ static int install_info_apply(const char *verb, LookupPaths *paths, InstallInfo
                 return -ENOENT;
         }
 
+        i->path = filename;
+
+        if ((r = config_parse(filename, f, NULL, items, true, i)) < 0) {
+                fclose(f);
+                return r;
+        }
+
         /* Consider unit files stored in /lib and /usr always enabled
          * if they have no [Install] data. */
         if (streq(verb, "is-enabled") &&
@@ -4168,13 +4175,6 @@ static int install_info_apply(const char *verb, LookupPaths *paths, InstallInfo
             !path_startswith(filename, "/etc"))
                 return 1;
 
-        i->path = filename;
-
-        if ((r = config_parse(filename, f, NULL, items, true, i)) < 0) {
-                fclose(f);
-                return r;
-        }
-
         n_symlinks += strv_length(i->aliases);
         n_symlinks += strv_length(i->wanted_by);