From 308b48b6a96c226d09d65e7a3b554396d6722449 Mon Sep 17 00:00:00 2001
From: pepak <pepak@pepak.net>
Date: Tue, 12 Mar 2019 17:32:06 +0100
Subject: [PATCH] Option to prevent display of file rights errors

---
 extra/Documentation/eng/TechInfo.txt | 2 ++
 far/copy.cpp                         | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/extra/Documentation/eng/TechInfo.txt b/extra/Documentation/eng/TechInfo.txt
index 14745b7f9..ed4e96ba1 100644
--- a/extra/Documentation/eng/TechInfo.txt
+++ b/extra/Documentation/eng/TechInfo.txt
@@ -552,6 +552,8 @@ the main help file, that is actual for the current Far Manager version.
                bit 4 is set to 0) or "Move" (both bits 3 and 4 are  set  to
                1) by default;
      5 - Copy dialog: remember option state for the current Far session.
+    31 - Do not display  any  error  messages  related  to  setting  access
+               rights.
    The effect of bits 0 and 1 depends on the state of bit 2:
    1. If bit 2 is set to 1 then the "Access  rights"  option  will  be  set
       according to bits 0 and 1 only in the first time the Move  dialog  is
diff --git a/far/copy.cpp b/far/copy.cpp
index b5fa8a44a..0025ad244 100644
--- a/far/copy.cpp
+++ b/far/copy.cpp
@@ -138,10 +138,12 @@ enum COPYSECURITYOPTIONS
 	CSO_COPY_SETCOPYSECURITY       = 3_bit,          // Copy: по умолчанию выставлять опцию "Copy access rights"?
 	CSO_COPY_SETINHERITSECURITY    = 3_bit | 4_bit, // Copy: по умолчанию выставлять опцию "Inherit access rights"?
 	CSO_COPY_SESSIONSECURITY       = 5_bit,          // Copy: сохранять состояние "access rights" внутри сессии?
+	CSO_NOERRORMESSAGE             = 31_bit,         // Do not display any error messages related to access rights settings
 };
 
 static int CopySecurityCopy=-1;
 static int CopySecurityMove=-1;
+static bool DefaultSkipSecurityErrors = false;
 
 static bool ZoomedState, IconicState;
 
@@ -516,6 +518,7 @@ ShellCopy::ShellCopy(panel_ptr SrcPanel,     // исходная панель (
 	string SingleSelName;
 	DWORD SingleSelAttributes = 0;
 	unsigned long long SingleSelectedFileSize = 0;
+	SkipSecurityErrors = DefaultSkipSecurityErrors;
 
 	if (SelCount==1)
 	{
@@ -995,6 +998,11 @@ ShellCopy::ShellCopy(panel_ptr SrcPanel,     // исходная панель (
 		Flags|=FCOPY_COPYPARENTSECURITY;
 
 	m_CopySecurity=Flags&FCOPY_COPYSECURITY?1:(Flags&FCOPY_LEAVESECURITY?2:0);
+	if (Global->Opt->CMOpt.CopySecurityOptions&CSO_NOERRORMESSAGE)
+	{
+		SkipSecurityErrors = true;
+		DefaultSkipSecurityErrors = true;
+	}
 
 	// в любом случае сохраняем сессионное запоминание (не для Link, т.к. для Link временное состояние - "ВСЕГДА!")
 	if (!Link)
-- 
2.21.0.windows.1

