anchor.diff:      try
         try
           SaveSimple(AFileName);
  -
  -        //workaround empty result file on Linux in smb dir, issue #3435
  -        if (Ed.Strings.Count>0) and IsBadResultFile(AFileName) then
  -        begin
  -          STempFilename:= GetTempFileName('', 'cudatext_');
  -          SaveSimple(STempFilename);
  -          if IsBadResultFile(STempFilename) then
  -            raise EFileNotFoundException.Create('Saved to an empty file');
  -          CopyFile(STempFilename, AFileName);
  -          if IsBadResultFile(AFileName) then
  -            raise EFileNotFoundException.Create('Saved to an empty file');
  -        end;
  -
         except
           on E: EConvertError do
             begin
  
positive.code:     AppFileAttrRestore(AFileName, OldAttr);
      exit;
    except
      if MsgBox(msgCannotSaveFile+#10+AFileName, MB_RETRYCANCEL or MB_ICONERROR) = IDCANCEL then
        exit(false);
    end;
  end;
  
  
negative.code:     Result:= (not FileExists(fn)) or (FileUtil.FileSize(fn)=0);
    end;
    //
    procedure SaveViaTempCopy(const fn: string);
    var
      fnTemp: string;
    begin
      fnTemp:= GetTempFileName('', 'cudatext_');
      SaveSimple(fnTemp);
      if IsBadResultFile(fnTemp) then
        raise EFileNotFoundException.Create('Cannot save to a temp file.');
      CopyFile(fnTemp, fn);
      if IsBadResultFile(fn) then
        raise EFileNotFoundException.CreateFmt('Cannot save to "%s". Saved to a temporary file "%s".', [fn, fnTemp]);
    end;
    //
  var
    OldEncoding: string;
    OldAttr: Longint;
  begin
    Result:= true;
    while true do
  