Skip to content
Permalink
Browse files

0003736: Can't update file descriptions on a network drive

  • Loading branch information...
alabuzhev committed Sep 3, 2019
1 parent 9a3e480 commit 9f88da120ef2d41fea8eec167f49a16b81ff12b9
Showing with 26 additions and 9 deletions.
  1. +4 −0 far/changelog
  2. +4 −0 far/changelog_eng
  3. +17 −8 far/file_io.cpp
  4. +1 −1 far/vbuild.m4
@@ -1,3 +1,7 @@
drkns 03.09.2019 23:19:24 +0100 - build 5465

1. 0003736: Невозможно изменить описание файла на сетевом диске

drkns 03.09.2019 01:01:01 +0100 - build 5464

1. Экспериментально:
@@ -3,6 +3,10 @@ This file is a translation of the main russian changelog and is provided by volu
It might not always be as up to date as the main changelog.
=======================================================================================

drkns 03.09.2019 23:19:24 +0100 - build 5465

1. 0003736: Can't update file descriptions on a network drive.

drkns 03.09.2019 01:01:01 +0100 - build 5464

1. Experimental:
@@ -89,14 +89,23 @@ void save_file_with_replace(string const& FileName, DWORD const FileAttributes,
}

{
os::fs::file OutFile(
OutFileName,
GENERIC_WRITE,
FILE_SHARE_READ,
SecurityDescriptor? &SecurityAttributes : nullptr,
IsFileExists && !UseTemporaryFile? TRUNCATE_EXISTING : CREATE_NEW,
// No FILE_ATTRIBUTE_SYSTEM at this point to avoid potential conflicts with FILE_ATTRIBUTE_ENCRYPTED. We will set it later.
NewAttributes & ~FILE_ATTRIBUTE_SYSTEM);
const auto create_file = [&](SECURITY_ATTRIBUTES* const Security, int const CreationDistribution)
{
return os::fs::file(
OutFileName,
GENERIC_WRITE,
FILE_SHARE_READ,
Security,
IsFileExists && !UseTemporaryFile? TRUNCATE_EXISTING : CreationDistribution,
// No FILE_ATTRIBUTE_SYSTEM at this point to avoid potential conflicts with FILE_ATTRIBUTE_ENCRYPTED. We will set it later.
NewAttributes & ~FILE_ATTRIBUTE_SYSTEM);
};

auto OutFile = create_file(SecurityDescriptor? &SecurityAttributes : nullptr, CREATE_NEW);

// M#0003736 Samba shares can be weird
if (!OutFile && GetLastError() == ERROR_INVALID_PARAMETER)
OutFile = create_file(nullptr, CREATE_ALWAYS);

if (!OutFile)
throw MAKE_FAR_EXCEPTION(L"Can't create a temporary file"sv);
@@ -1 +1 @@
5464
5465

0 comments on commit 9f88da1

Please sign in to comment.
You can’t perform that action at this time.