diff --git a/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp b/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp index 9b333b70..b83765d7 100644 --- a/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp +++ b/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp @@ -102,7 +102,9 @@ auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/, PWSTR * /*Argv*/) ((mount_location.size() == 3U) && (mount_location[2U] == '\\'))) && (mount_location[1U] == ':'); - auto ret = drive_letter ? STATUS_DEVICE_BUSY : STATUS_NOT_SUPPORTED; + auto ret{ + drive_letter ? STATUS_DEVICE_BUSY : STATUS_NOT_SUPPORTED, + }; if ((drive_letter && not utils::file::directory(mount_location).exists())) { auto unicode_mount_location = utils::string::from_utf8(mount_location); host_.SetFileSystemName(unicode_mount_location.data()); @@ -118,16 +120,17 @@ auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/, PWSTR * /*Argv*/) << mount_location << std::endl; } - if (ret != STATUS_SUCCESS) { - if (not lock_.set_mount_state(false, "", -1)) { - utils::error::raise_error(function_name, ret, - "failed to set mount state"); - } - - event_system::instance().raise(mount_location, - std::to_string(ret)); + if (ret == STATUS_SUCCESS) { + return ret; } + if (not lock_.set_mount_state(false, "", -1)) { + utils::error::raise_error(function_name, ret, "failed to set mount state"); + } + + event_system::instance().raise(mount_location, + std::to_string(ret)); + return ret; }