OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #include "util/mac/xattr.h" | 15 #include "util/mac/xattr.h" |
16 | 16 |
17 #include <errno.h> | 17 #include <errno.h> |
18 #include <stdint.h> | 18 #include <stdint.h> |
| 19 #include <sys/types.h> |
19 #include <sys/xattr.h> | 20 #include <sys/xattr.h> |
20 | 21 |
21 #include "base/basictypes.h" | |
22 #include "base/logging.h" | 22 #include "base/logging.h" |
| 23 #include "base/macros.h" |
23 #include "base/numerics/safe_conversions.h" | 24 #include "base/numerics/safe_conversions.h" |
| 25 #include "base/strings/string_number_conversions.h" |
24 #include "base/strings/stringprintf.h" | 26 #include "base/strings/stringprintf.h" |
25 #include "base/strings/string_number_conversions.h" | |
26 | 27 |
27 namespace crashpad { | 28 namespace crashpad { |
28 | 29 |
29 XattrStatus ReadXattr(const base::FilePath& file, | 30 XattrStatus ReadXattr(const base::FilePath& file, |
30 const base::StringPiece& name, | 31 const base::StringPiece& name, |
31 std::string* value) { | 32 std::string* value) { |
32 // First get the size of the attribute value. | 33 // First get the size of the attribute value. |
33 ssize_t buffer_size = getxattr(file.value().c_str(), name.data(), nullptr, | 34 ssize_t buffer_size = getxattr(file.value().c_str(), name.data(), nullptr, |
34 0, 0, 0); | 35 0, 0, 0); |
35 if (buffer_size < 0) { | 36 if (buffer_size < 0) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 142 } |
142 | 143 |
143 bool WriteXattrTimeT(const base::FilePath& file, | 144 bool WriteXattrTimeT(const base::FilePath& file, |
144 const base::StringPiece& name, | 145 const base::StringPiece& name, |
145 time_t value) { | 146 time_t value) { |
146 std::string tmp = base::StringPrintf("%ld", value); | 147 std::string tmp = base::StringPrintf("%ld", value); |
147 return WriteXattr(file, name, tmp); | 148 return WriteXattr(file, name, tmp); |
148 } | 149 } |
149 | 150 |
150 } // namespace crashpad | 151 } // namespace crashpad |
OLD | NEW |