Index: util/mac/xattr.cc |
diff --git a/util/mac/xattr.cc b/util/mac/xattr.cc |
index 750a056d4bac995d64690f8fd4fb5d962281b53c..cdd92090d46f92c764362739057d47a01e6e7d04 100644 |
--- a/util/mac/xattr.cc |
+++ b/util/mac/xattr.cc |
@@ -14,6 +14,7 @@ |
#include "util/mac/xattr.h" |
+#include <errno.h> |
#include <stdint.h> |
#include <sys/xattr.h> |
@@ -25,6 +26,15 @@ |
namespace crashpad { |
+bool HasXattr(const base::FilePath& file, const base::StringPiece& name) { |
+ if (getxattr(file.value().c_str(), name.data(), nullptr, 0, 0, 0) < 0) { |
+ PLOG_IF(ERROR, errno != ENOATTR) |
+ << "getxattr exists " << name << " on file " << file.value(); |
+ return false; |
+ } |
+ return true; |
+} |
+ |
bool ReadXattr(const base::FilePath& file, |
const base::StringPiece& name, |
std::string* value) { |