]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/swap: load() should fail when neither of corresponding unit file nor /proc/swap... 7387/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 19 Nov 2017 16:00:34 +0000 (01:00 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 20 Nov 2017 00:35:35 +0000 (09:35 +0900)
It is not necessary to label as loaded to a swap unit when neither of
corresponding unit file nor entry in /proc/swap does not exist.
This makes swap_load() to fail such a case.

Partially fixes #7370.

src/core/swap.c

index cfe9d91cedb9d4e7725e6d0228491eb9ab2a0d23..f37a81f56c754369c1ce536fb9709a6dd1270119 100644 (file)
@@ -292,7 +292,10 @@ static int swap_load(Unit *u) {
         assert(u->load_state == UNIT_STUB);
 
         /* Load a .swap file */
-        r = unit_load_fragment_and_dropin_optional(u);
+        if (SWAP(u)->from_proc_swaps)
+                r = unit_load_fragment_and_dropin_optional(u);
+        else
+                r = unit_load_fragment_and_dropin(u);
         if (r < 0)
                 return r;