Fix occasional crash in mkdir() on Windows

This commit is contained in:
Sebastian Messmer 2019-05-25 13:35:44 -07:00
parent 7d40937b9a
commit 1d422cbb38
3 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,8 @@
Version 0.10.2 (unreleased)
---------------
Fixed bugs:
* Fix occasional crash in mkdir() on Windows
Improvements:
* Better logging when local state can't be loaded

View File

@ -179,7 +179,7 @@ optional<unique_ref<fspp::Symlink>> CryDevice::LoadSymlink(const bf::path &path)
optional<unique_ref<fspp::Node>> CryDevice::Load(const bf::path &path) {
// TODO Is it faster to not let CryFile/CryDir/CryDevice inherit from CryNode and loading CryNode without having to know what it is?
// TODO Split into smaller functions
ASSERT(path.has_root_directory() && !path.has_root_name(), "Must be an absolute path (but on windows without device specifier)");
ASSERT(path.has_root_directory() && !path.has_root_name(), "Must be an absolute path (but on windows without device specifier): " + path.string());
callFsActionCallbacks();

View File

@ -451,6 +451,11 @@ int Fuse::mkdir(const bf::path &path, ::mode_t mode) {
#endif
try {
ASSERT(is_valid_fspp_path(path), "has to be an absolute path");
// DokanY seems to call mkdir("/"). Ignore that
if ("/" == path) {
return 0;
}
auto context = fuse_get_context();
_fs->mkdir(path, mode, context->uid, context->gid);
return 0;