summaryrefslogtreecommitdiff
path: root/devel/electron4/files/patch-components_download_quarantine_quarantine__linux.cc
blob: ee969234e47a4c41abb667f4db6d9eb2be8f593e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
--- components/download/quarantine/quarantine_linux.cc.orig	2019-03-15 06:37:14 UTC
+++ components/download/quarantine/quarantine_linux.cc
@@ -2,11 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "build/build_config.h"
+
 #include "components/download/quarantine/quarantine.h"
 
 #include <stddef.h>
 #include <sys/types.h>
+#if !defined(OS_BSD)
 #include <sys/xattr.h>
+#endif
 
 #include "base/files/file_path.h"
 #include "base/files/file_util.h"
@@ -29,17 +33,20 @@ bool SetExtendedFileAttribute(const char* path,
                               size_t value_size,
                               int flags) {
   base::AssertBlockingAllowed();
+#if !defined(OS_BSD)
   int result = setxattr(path, name, value, value_size, flags);
   if (result) {
     DPLOG(ERROR) << "Could not set extended attribute " << name << " on file "
                  << path;
     return false;
   }
+#endif
   return true;
 }
 
 std::string GetExtendedFileAttribute(const char* path, const char* name) {
   base::AssertBlockingAllowed();
+#if !defined(OS_BSD)
   ssize_t len = getxattr(path, name, nullptr, 0);
   if (len <= 0)
     return std::string();
@@ -49,6 +56,9 @@ std::string GetExtendedFileAttribute(const char* path,
   if (len < static_cast<ssize_t>(buffer.size()))
     return std::string();
   return std::string(buffer.begin(), buffer.end());
+#else
+  return std::string();
+#endif
 }
 
 }  // namespace