Since 0.9.3-alpha set the config value cryfs.blocksizeBytes wrongly to 32768 (but didn't use the value), we have to add a workaround.

This commit is contained in:
Sebastian Messmer 2016-03-26 23:53:08 +08:00
parent 078ab78c5a
commit 03f59b69da

View File

@ -5,6 +5,7 @@
#include <cpp-utils/logging/logging.h>
#include <boost/algorithm/string/predicate.hpp>
#include <gitversion/gitversion.h>
#include <gitversion/VersionCompare.h>
namespace bf = boost::filesystem;
using cpputils::unique_ref;
@ -21,6 +22,7 @@ using std::vector;
using std::string;
using std::function;
using std::shared_ptr;
using gitversion::VersionCompare;
using namespace cpputils::logging;
namespace cryfs {
@ -40,6 +42,13 @@ optional<CryConfigFile> CryConfigLoader::_loadConfig(const bf::path &filename) {
}
std::cout << "done" << std::endl;
_checkVersion(*config->config());
#ifndef CRYFS_NO_COMPATIBILITY
//Since 0.9.3-alpha set the config value cryfs.blocksizeBytes wrongly to 32768 (but didn't use the value), we have to fix this here.
if (config->config()->Version() != "0+unknown" && VersionCompare::isOlderThan(config->config()->Version(), "0.9.3-rc1")) {
config->config()->SetBlocksizeBytes(32832);
std::cout << "Workaround BlockSize" << std::endl;
}
#endif
if (config->config()->Version() != gitversion::VersionString()) {
config->config()->SetVersion(gitversion::VersionString());
config->save();