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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 if (file_writer->Seek(start_offset, SEEK_SET) != 0) { | 166 if (file_writer->Seek(start_offset, SEEK_SET) != 0) { |
167 return false; | 167 return false; |
168 } | 168 } |
169 | 169 |
170 if (!file_writer->Write(&header_, sizeof(header_))) { | 170 if (!file_writer->Write(&header_, sizeof(header_))) { |
171 return false; | 171 return false; |
172 } | 172 } |
173 | 173 |
174 // Seek back to the end of the file, in case some non-minidump content will be | 174 // Seek back to the end of the file, in case some non-minidump content will be |
175 // written to the file after the minidump content. | 175 // written to the file after the minidump content. |
176 return file_writer->Seek(end_offset, SEEK_SET); | 176 return file_writer->Seek(end_offset, SEEK_SET) >= 0; |
177 } | 177 } |
178 | 178 |
179 bool MinidumpFileWriter::Freeze() { | 179 bool MinidumpFileWriter::Freeze() { |
180 DCHECK_EQ(state(), kStateMutable); | 180 DCHECK_EQ(state(), kStateMutable); |
181 | 181 |
182 if (!MinidumpWritable::Freeze()) { | 182 if (!MinidumpWritable::Freeze()) { |
183 return false; | 183 return false; |
184 } | 184 } |
185 | 185 |
186 size_t stream_count = streams_.size(); | 186 size_t stream_count = streams_.size(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 for (internal::MinidumpStreamWriter* stream : streams_) { | 239 for (internal::MinidumpStreamWriter* stream : streams_) { |
240 iov.iov_base = stream->DirectoryListEntry(); | 240 iov.iov_base = stream->DirectoryListEntry(); |
241 iov.iov_len = sizeof(MINIDUMP_DIRECTORY); | 241 iov.iov_len = sizeof(MINIDUMP_DIRECTORY); |
242 iovecs.push_back(iov); | 242 iovecs.push_back(iov); |
243 } | 243 } |
244 | 244 |
245 return file_writer->WriteIoVec(&iovecs); | 245 return file_writer->WriteIoVec(&iovecs); |
246 } | 246 } |
247 | 247 |
248 } // namespace crashpad | 248 } // namespace crashpad |
OLD | NEW |