[bug] Windows-to-Linux remote mount ignores CREATE_NEW #44
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
This commit is contained in:
parent
dfa170022a
commit
281d3758e0
@ -1126,9 +1126,7 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
|
|||||||
utils::file::directory{file_path}.exists();
|
utils::file::directory{file_path}.exists();
|
||||||
|
|
||||||
auto ret{static_cast<packet::error_type>(STATUS_SUCCESS)};
|
auto ret{static_cast<packet::error_type>(STATUS_SUCCESS)};
|
||||||
if (exists) {
|
if (not exists) {
|
||||||
ret = static_cast<packet::error_type>(STATUS_OBJECT_NAME_COLLISION);
|
|
||||||
} else {
|
|
||||||
if ((create_options & FILE_DIRECTORY_FILE) != 0U) {
|
if ((create_options & FILE_DIRECTORY_FILE) != 0U) {
|
||||||
attributes |= FILE_ATTRIBUTE_DIRECTORY;
|
attributes |= FILE_ATTRIBUTE_DIRECTORY;
|
||||||
} else {
|
} else {
|
||||||
|
@ -188,20 +188,23 @@ auto remote_client::winfsp_create(PWSTR file_name, UINT32 create_options,
|
|||||||
DECODE_OR_IGNORE(&response, normalized_name);
|
DECODE_OR_IGNORE(&response, normalized_name);
|
||||||
DECODE_OR_IGNORE(&response, exists);
|
DECODE_OR_IGNORE(&response, exists);
|
||||||
|
|
||||||
*file_desc = reinterpret_cast<PVOID>(handle);
|
if (exists == 0U) {
|
||||||
set_open_info(to_handle(*file_desc), open_info{
|
*file_desc = reinterpret_cast<PVOID>(handle);
|
||||||
"",
|
set_open_info(to_handle(*file_desc),
|
||||||
nullptr,
|
open_info{
|
||||||
{},
|
"",
|
||||||
utils::string::to_utf8(file_name),
|
nullptr,
|
||||||
});
|
{},
|
||||||
}
|
utils::string::to_utf8(file_name),
|
||||||
|
});
|
||||||
|
}
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
if (ret == STATUS_OBJECT_NAME_COLLISION && exists != 0U) {
|
else {
|
||||||
::SetLastError(ERROR_ALREADY_EXISTS);
|
ret = STATUS_OBJECT_NAME_COLLISION;
|
||||||
}
|
::SetLastError(ERROR_FILE_EXISTS);
|
||||||
|
}
|
||||||
#endif // defined(_WIN32)
|
#endif // defined(_WIN32)
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -131,14 +131,14 @@ auto remote_winfsp_drive::Create(PWSTR file_name, UINT32 create_options,
|
|||||||
UINT64 allocation_size, PVOID * /*file_node*/,
|
UINT64 allocation_size, PVOID * /*file_node*/,
|
||||||
PVOID *file_desc, OpenFileInfo *ofi)
|
PVOID *file_desc, OpenFileInfo *ofi)
|
||||||
-> NTSTATUS {
|
-> NTSTATUS {
|
||||||
remote::file_info fi{};
|
remote::file_info f_info{};
|
||||||
std::string normalized_name;
|
std::string normalized_name;
|
||||||
BOOLEAN exists = 0;
|
BOOLEAN exists{0};
|
||||||
auto ret = remote_instance_->winfsp_create(
|
auto ret = remote_instance_->winfsp_create(
|
||||||
file_name, create_options, granted_access, attributes, allocation_size,
|
file_name, create_options, granted_access, attributes, allocation_size,
|
||||||
file_desc, &fi, normalized_name, exists);
|
file_desc, &f_info, normalized_name, exists);
|
||||||
if (ret == STATUS_SUCCESS) {
|
if (ret == STATUS_SUCCESS) {
|
||||||
set_file_info(ofi->FileInfo, fi);
|
set_file_info(ofi->FileInfo, f_info);
|
||||||
auto file_path = utils::string::from_utf8(normalized_name);
|
auto file_path = utils::string::from_utf8(normalized_name);
|
||||||
wcsncpy(ofi->NormalizedName, file_path.data(), wcslen(file_path.c_str()));
|
wcsncpy(ofi->NormalizedName, file_path.data(), wcslen(file_path.c_str()));
|
||||||
ofi->NormalizedNameSize =
|
ofi->NormalizedNameSize =
|
||||||
|
@ -263,6 +263,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void execute_unmount(auto args, auto location) {
|
static void execute_unmount(auto args, auto location) {
|
||||||
|
std::this_thread::sleep_for(10s);
|
||||||
auto unmounted{false};
|
auto unmounted{false};
|
||||||
|
|
||||||
auto unmount_cmd =
|
auto unmount_cmd =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user