]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mount: support "-o move" on command line
authorKarel Zak <kzak@redhat.com>
Wed, 15 Apr 2020 11:24:23 +0000 (13:24 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 15 Apr 2020 11:39:48 +0000 (13:39 +0200)
Addresses: https://github.com/karelzak/util-linux/issues/997
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/mount.c

index 257e355fe801c916bfba874b5c955cc3a4229790..49d3beb0d51d485279d8e301374f5d584ade0ab1 100644 (file)
@@ -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))