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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 146 } |
147 | 147 |
148 ProcessSnapshotMac process_snapshot; | 148 ProcessSnapshotMac process_snapshot; |
149 if (!process_snapshot.Initialize(task)) { | 149 if (!process_snapshot.Initialize(task)) { |
150 return EXIT_FAILURE; | 150 return EXIT_FAILURE; |
151 } | 151 } |
152 | 152 |
153 FileWriter file_writer; | 153 FileWriter file_writer; |
154 if (!file_writer.Open(base::FilePath(options.dump_path), | 154 if (!file_writer.Open(base::FilePath(options.dump_path), |
155 FileWriteMode::kTruncateOrCreate, | 155 FileWriteMode::kTruncateOrCreate, |
156 true)) { | 156 FilePermissions::kWorldReadable)) { |
157 return EXIT_FAILURE; | 157 return EXIT_FAILURE; |
158 } | 158 } |
159 | 159 |
160 MinidumpFileWriter minidump; | 160 MinidumpFileWriter minidump; |
161 minidump.InitializeFromSnapshot(&process_snapshot); | 161 minidump.InitializeFromSnapshot(&process_snapshot); |
162 if (!minidump.WriteEverything(&file_writer)) { | 162 if (!minidump.WriteEverything(&file_writer)) { |
163 if (unlink(options.dump_path.c_str()) != 0) { | 163 if (unlink(options.dump_path.c_str()) != 0) { |
164 PLOG(ERROR) << "unlink"; | 164 PLOG(ERROR) << "unlink"; |
165 } | 165 } |
166 return EXIT_FAILURE; | 166 return EXIT_FAILURE; |
167 } | 167 } |
168 } | 168 } |
169 | 169 |
170 return EXIT_SUCCESS; | 170 return EXIT_SUCCESS; |
171 } | 171 } |
172 | 172 |
173 } // namespace | 173 } // namespace |
174 } // namespace crashpad | 174 } // namespace crashpad |
175 | 175 |
176 int main(int argc, char* argv[]) { | 176 int main(int argc, char* argv[]) { |
177 return crashpad::GenerateDumpMain(argc, argv); | 177 return crashpad::GenerateDumpMain(argc, argv); |
178 } | 178 } |
OLD | NEW |