From a8906113576b96a8943ed9f5e6a8582745134b1d Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 15 Apr 2020 13:24:23 +0200 Subject: [PATCH] mount: support "-o move" on command line Addresses: https://github.com/karelzak/util-linux/issues/997 Signed-off-by: Karel Zak --- sys-utils/mount.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys-utils/mount.c b/sys-utils/mount.c index 257e355fe..49d3beb0d 100644 --- a/sys-utils/mount.c +++ b/sys-utils/mount.c @@ -709,7 +709,18 @@ int main(int argc, char **argv) mnt_context_enable_rwonly_mount(cxt, TRUE); break; case 'o': - append_option(cxt, optarg); + /* "move" is not supported as option string in libmount + * to avoid use in fstab */ + if (mnt_optstr_get_option(optarg, "move", NULL, 0) == 0) { + char *o = xstrdup(optarg); + + mnt_optstr_remove_option(&o, "move"); + if (o && *o) + append_option(cxt, o); + oper = is_move = 1; + free(o); + } else + append_option(cxt, optarg); break; case 'O': if (mnt_context_set_options_pattern(cxt, optarg))