summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2017-11-20 01:00:34 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2017-11-20 09:35:35 +0900
commit3000f85014e891675c996c1024ee9dce48189757 (patch)
treeb74270427b05238815096345b8eb7aea8e3ee134 /src
parent4a78b637808c5ba436dbbcaef54724be827298fd (diff)
downloadsystemd-3000f85014e891675c996c1024ee9dce48189757.tar.gz
systemd-3000f85014e891675c996c1024ee9dce48189757.tar.bz2
systemd-3000f85014e891675c996c1024ee9dce48189757.zip
core/swap: load() should fail when neither of corresponding unit file nor /proc/swap entry does not exist
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.
Diffstat (limited to 'src')
-rw-r--r--src/core/swap.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/swap.c b/src/core/swap.c
index cfe9d91ced..f37a81f56c 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -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;