From d664c6a884893d3a1ca026dcdc8ed7502d8cdc5c Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Thu, 17 Apr 2025 13:20:00 -0500 Subject: [PATCH] fix winfsp rename --- .../librepertory/src/drives/winfsp/winfsp_drive.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp b/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp index 1b954019..2bd33f9f 100644 --- a/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp +++ b/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp @@ -1023,8 +1023,15 @@ auto winfsp_drive::Rename(PVOID /*file_node*/, PVOID /*file_desc*/, const auto handle_error = [this, &from_api_path, &to_api_path](api_error error) -> NTSTATUS { - return this->handle_error(function_name, from_api_path + '|' + to_api_path, - error, nullptr, 0U); + auto ret = this->handle_error( + function_name, from_api_path + '|' + to_api_path, error, nullptr, 0U); + if (ret == FspNtStatusFromWin32(ERROR_FILE_EXISTS)) { + ret = FspNtStatusFromWin32(ERROR_ALREADY_EXISTS); + } else if (ret == STATUS_OBJECT_NAME_EXISTS) { + ret = STATUS_ACCESS_DENIED; + } + + return ret; }; bool exists{};