Fix an issue when using `-o` atime mount options

This commit is contained in:
Sebastian Messmer 2023-08-06 22:14:40 -07:00
parent 2c86a6ed37
commit c5187bb0d7
2 changed files with 20 additions and 4 deletions

View File

@ -1,3 +1,7 @@
Version 0.11.5 (unreleased)
---------------
* Fix an issue when using `-o` atime mount options
Version 0.11.4
---------------
* Fixed build issue with GCC 13 (see https://github.com/cryfs/cryfs/pull/448 )

View File

@ -338,12 +338,24 @@ void extractAllAtimeOptionsAndRemoveOnesUnknownToLibfuse_(string* csv_options, v
vector<string> extractAllAtimeOptionsAndRemoveOnesUnknownToLibfuse_(vector<string>* fuseOptions) {
vector<string> result;
bool lastOptionWasDashO = false;
for (string& option : *fuseOptions) {
if (lastOptionWasDashO) {
extractAllAtimeOptionsAndRemoveOnesUnknownToLibfuse_(&option, &result);
for (size_t i = 0; i < fuseOptions->size(); ++i)
{
string &option = (*fuseOptions)[i];
if (lastOptionWasDashO)
{
extractAllAtimeOptionsAndRemoveOnesUnknownToLibfuse_(&option, &result);
if (option.empty()) {
// All options were removed, remove the empty argument
fuseOptions->erase(fuseOptions->begin() + i);
--i;
// And also remove the now value-less '-o' before it
fuseOptions->erase(fuseOptions->begin() + i);
--i;
}
lastOptionWasDashO = (option == "-o");
}
lastOptionWasDashO = (option == "-o");
}
return result;
}
}