From: Yu Watanabe Date: Tue, 23 May 2023 22:24:52 +0000 (+0900) Subject: fstab-generator: refuse to add swap earlier if disabled X-Git-Tag: v254-rc1~372^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9445623363;p=thirdparty%2Fsystemd.git fstab-generator: refuse to add swap earlier if disabled No functional change, preparation for later commits. --- diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index 042cce1ffaf..5776eb421a8 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -111,11 +111,6 @@ static int add_swap( assert(what); - if (!arg_swap_enabled) { - log_info("Swap unit generation disabled on kernel command line, ignoring fstab swap entry for %s.", what); - return 0; - } - if (access("/proc/swaps", F_OK) < 0) { log_info("Swap not supported, ignoring fstab swap entry for %s.", what); return 0; @@ -718,6 +713,10 @@ static int parse_fstab_one( return 0; is_swap = streq_ptr(fstype, "swap"); + if (is_swap && !arg_swap_enabled) { + log_info("Swap unit generation disabled on kernel command line, ignoring swap entry for %s.", what); + return 0; + } what = fstab_node_to_udev_node(what_original); if (!what)