From 8d27c2000bf27f6a4e2c4f36d05b88ffe1fac515 Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Tue, 14 Mar 2017 12:39:19 +0000 Subject: [PATCH] Fix late and noauto with geli swap With the following in /etc/fstab: /dev/gpt/swap.eli none swap sw,late 0 0 swap will not be enabled, with `swapon -aL' complaining: swapon: Invalid option: late This happens because swap_on_geli_args() which parses geli arguments out of all mount options does not expect late or noauto among them. Fix this by explicitly allowing these arguments. Reviewed by: jilles Approved by: jilles MFC after: 2 weeks Differential Revision: D9835 --- sbin/swapon/swapon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sbin/swapon/swapon.c b/sbin/swapon/swapon.c index 9c385e5a1f4b..f11f0d664fef 100644 --- a/sbin/swapon/swapon.c +++ b/sbin/swapon/swapon.c @@ -375,8 +375,12 @@ swap_on_geli_args(const char *mntops) free(ops); return (NULL); } - } else if ((p = strstr(token, "notrim")) == token) { + } else if (strcmp(token, "notrim") == 0) { Tflag = " -T "; + } else if (strcmp(token, "late") == 0) { + /* ignore known option */ + } else if (strcmp(token, "noauto") == 0) { + /* ignore known option */ } else if (strcmp(token, "sw") != 0) { warnx("Invalid option: %s", token); free(ops);