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, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 bool WriteXattrInt(const base::FilePath& file, | 110 bool WriteXattrInt(const base::FilePath& file, |
111 const base::StringPiece& name, | 111 const base::StringPiece& name, |
112 int value) { | 112 int value) { |
113 std::string tmp = base::StringPrintf("%d", value); | 113 std::string tmp = base::StringPrintf("%d", value); |
114 return WriteXattr(file, name, tmp); | 114 return WriteXattr(file, name, tmp); |
115 } | 115 } |
116 | 116 |
117 XattrStatus ReadXattrTimeT(const base::FilePath& file, | 117 XattrStatus ReadXattrTimeT(const base::FilePath& file, |
118 const base::StringPiece& name, | 118 const base::StringPiece& name, |
119 time_t* value) { | 119 time_t* value) { |
120 // time_t on OS X is defined as a long, but it will be read into an | 120 // time_t on macOS is defined as a long, but it will be read into an int64_t |
121 // int64_t here, since there is no string conversion method for long. | 121 // here, since there is no string conversion method for long. |
122 std::string tmp; | 122 std::string tmp; |
123 XattrStatus status; | 123 XattrStatus status; |
124 if ((status = ReadXattr(file, name, &tmp)) != XattrStatus::kOK) | 124 if ((status = ReadXattr(file, name, &tmp)) != XattrStatus::kOK) |
125 return status; | 125 return status; |
126 | 126 |
127 int64_t encoded_value; | 127 int64_t encoded_value; |
128 if (!base::StringToInt64(tmp, &encoded_value)) { | 128 if (!base::StringToInt64(tmp, &encoded_value)) { |
129 LOG(ERROR) << "ReadXattrTimeT " << name << " on file " << file.value() | 129 LOG(ERROR) << "ReadXattrTimeT " << name << " on file " << file.value() |
130 << " could not be converted to an int"; | 130 << " could not be converted to an int"; |
131 return XattrStatus::kOtherError; | 131 return XattrStatus::kOtherError; |
(...skipping 22 matching lines...) Expand all Loading... |
154 if (rv != 0) { | 154 if (rv != 0) { |
155 if (errno == ENOATTR) | 155 if (errno == ENOATTR) |
156 return XattrStatus::kNoAttribute; | 156 return XattrStatus::kNoAttribute; |
157 PLOG(ERROR) << "removexattr " << name << " on file " << file.value(); | 157 PLOG(ERROR) << "removexattr " << name << " on file " << file.value(); |
158 return XattrStatus::kOtherError; | 158 return XattrStatus::kOtherError; |
159 } | 159 } |
160 return XattrStatus::kOK; | 160 return XattrStatus::kOK; |
161 } | 161 } |
162 | 162 |
163 } // namespace crashpad | 163 } // namespace crashpad |
OLD | NEW |