From e09610e78956cf7e3ef7387bd99cc406f5acb327 Mon Sep 17 00:00:00 2001 From: James Kay Date: Wed, 15 Sep 2021 16:50:45 +0100 Subject: [PATCH] Allow mount options to contain colons. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is particularly important for overlayfs, which allows multiple layers to be given to `lowerdir` separated by colons: see , section ‘Multiple lower layers’. --- cmdline.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmdline.cc b/cmdline.cc index 0e98cd0..9aa1aba 100644 --- a/cmdline.cc +++ b/cmdline.cc @@ -43,6 +43,7 @@ #include #include +#include #include #include @@ -777,7 +778,12 @@ std::unique_ptr parseArgs(int argc, char* argv[]) { dst = src; } std::string fs_type = argFromVec(subopts, 2); - std::string options = argFromVec(subopts, 3); + std::stringstream optionsStream; + optionsStream << argFromVec(subopts, 3); + for (std::size_t i = 4; i < subopts.size(); ++i) { + optionsStream << ":" << subopts[i]; + } + std::string options = optionsStream.str(); if (!mnt::addMountPtTail(nsjconf.get(), src, dst, /* fstype= */ fs_type, /* options= */ options, /* flags= */ 0, /* is_dir= */ mnt::NS_DIR_MAYBE, /* is_mandatory= */ true,