diff --git a/src/fspp/fuse/Fuse.cpp b/src/fspp/fuse/Fuse.cpp index e41e6e01..e5209ffb 100644 --- a/src/fspp/fuse/Fuse.cpp +++ b/src/fspp/fuse/Fuse.cpp @@ -260,9 +260,13 @@ void Fuse::_add_fuse_option_if_not_exists(vector *argv, const string &ke } bool Fuse::_has_option(const vector &vec, const string &key) { - string key_with_prefix = key + "+"; - auto found = std::find_if(vec.begin(), vec.end(), [&key_with_prefix](const char *entry) { - return std::strncmp(key_with_prefix.c_str(), entry, key_with_prefix.size()); + // The fuse option can either be present as "-okey=value" or as "-o key=value", we have to check both. + return _has_entry_with_prefix(key + "=", vec) || _has_entry_with_prefix("-o" + key + "=", vec); +} + +bool Fuse::_has_entry_with_prefix(const string &prefix, const vector &vec) { + auto found = std::find_if(vec.begin(), vec.end(), [&prefix](const char *entry) { + return 0 == std::strncmp(prefix.c_str(), entry, prefix.size()); }); return found != vec.end(); } diff --git a/src/fspp/fuse/Fuse.h b/src/fspp/fuse/Fuse.h index 005b7071..91470121 100644 --- a/src/fspp/fuse/Fuse.h +++ b/src/fspp/fuse/Fuse.h @@ -62,6 +62,7 @@ private: static void _logUnknownException(); static char *_create_c_string(const std::string &str); static bool _has_option(const std::vector &vec, const std::string &key); + static bool _has_entry_with_prefix(const std::string &prefix, const std::vector &vec); std::vector _build_argv(const boost::filesystem::path &mountdir, const std::vector &fuseOptions); void _add_fuse_option_if_not_exists(std::vector *argv, const std::string &key, const std::string &value);