summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2018-06-01 12:11:03 +0200
committerKarel Zak2018-06-01 12:11:03 +0200
commit4ebea84bb1ca6b0fa817588aba13de26c8d5e5a0 (patch)
tree3486dfb351a9aeff0d53649a7f00ef37c8f4018e
parentlibmount: include sys/mount.h on Linux only (diff)
downloadkernel-qcow2-util-linux-4ebea84bb1ca6b0fa817588aba13de26c8d5e5a0.tar.gz
kernel-qcow2-util-linux-4ebea84bb1ca6b0fa817588aba13de26c8d5e5a0.tar.xz
kernel-qcow2-util-linux-4ebea84bb1ca6b0fa817588aba13de26c8d5e5a0.zip
mount: use internally string to set move/bind operations
It's better to inform libmount about operations by string than by flags, because for example "rbind,slave" cannot be specified by MS_REC|MS_BIND|MS_SLAVE. https://bugzilla.redhat.com/show_bug.cgi?id=1584443 Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--sys-utils/mount.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sys-utils/mount.c b/sys-utils/mount.c
index 3a7bbf6dd..22672c40b 100644
--- a/sys-utils/mount.c
+++ b/sys-utils/mount.c
@@ -517,7 +517,7 @@ int main(int argc, char **argv)
struct libmnt_table *fstab = NULL;
char *srcbuf = NULL;
char *types = NULL;
- unsigned long oper = 0;
+ int oper = 0;
int propa = 0;
int optmode = 0, optmode_mode = 0, optmode_src = 0;
@@ -679,13 +679,16 @@ int main(int argc, char **argv)
mnt_context_enable_sloppy(cxt, TRUE);
break;
case 'B':
- oper |= MS_BIND;
+ oper = 1;
+ append_option(cxt, "bind");
break;
case 'M':
- oper |= MS_MOVE;
+ oper = 1;
+ append_option(cxt, "move");
break;
case 'R':
- oper |= (MS_BIND | MS_REC);
+ oper = 1;
+ append_option(cxt, "rbind");
break;
case MOUNT_OPT_SHARED:
append_option(cxt, "shared");
@@ -867,10 +870,6 @@ int main(int argc, char **argv)
if (mnt_context_is_restricted(cxt))
sanitize_paths(cxt);
- if (oper)
- /* BIND/MOVE operations, let's set the mount flags */
- mnt_context_set_mflags(cxt, oper);
-
if ((oper && !has_remount_flag(cxt)) || propa)
/* For --make-* or --bind is fstab/mtab unnecessary */
mnt_context_set_optsmode(cxt, MNT_OMODE_NOTAB);