Merge pull request #2263 from eryugey/eryugey/for-main

agent: clear MsFlags if the option has clear flag set
This commit is contained in:
Fabiano Fidêncio 2021-07-20 12:50:45 +02:00 committed by GitHub
commit 75c5edd66a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -549,9 +549,13 @@ fn parse_mount_flags_and_options(options_vec: Vec<&str>) -> (MsFlags, String) {
if !opt.is_empty() {
match FLAGS.get(opt) {
Some(x) => {
let (_, f) = *x;
let (clear, f) = *x;
if clear {
flags &= !f;
} else {
flags |= f;
}
}
None => {
if !options.is_empty() {
options.push_str(format!(",{}", opt).as_str());

View File

@ -121,8 +121,12 @@ impl Namespace {
let mut flags = MsFlags::empty();
if let Some(x) = FLAGS.get("rbind") {
let (_, f) = *x;
let (clear, f) = *x;
if clear {
flags &= !f;
} else {
flags |= f;
}
};
let bare_mount = BareMount::new(source, destination, "none", flags, "", &logger);