From 4a78b637808c5ba436dbbcaef54724be827298fd Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 19 Nov 2017 16:45:35 +0900 Subject: [PATCH 1/2] core/automount: load() should fail when the unit file does not exist It is not necessary to label as loaded to automount unit when its unit file does not exist. So, let's make automount_load() to fail when the unit file does not exist. Partially fixes #7370. --- src/core/automount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/automount.c b/src/core/automount.c index e01b3ed9d3..cbcc8abb2b 100644 --- a/src/core/automount.c +++ b/src/core/automount.c @@ -224,7 +224,7 @@ static int automount_load(Unit *u) { assert(u->load_state == UNIT_STUB); /* Load a .automount file */ - r = unit_load_fragment_and_dropin_optional(u); + r = unit_load_fragment_and_dropin(u); if (r < 0) return r; From 3000f85014e891675c996c1024ee9dce48189757 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 20 Nov 2017 01:00:34 +0900 Subject: [PATCH 2/2] 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. --- src/core/swap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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;