Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: third_party/crashpad/crashpad/tools/crashpad_database_util.cc

Issue 2773813002: Update Crashpad to 8e37886d418dd042c3c7bfadac99214739ee4d98 (Closed)
Patch Set: Update Crashpad to 8e37886d418dd042c3c7bfadac99214739ee4d98 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/crashpad/crashpad/tools/crashpad_database_util.cc
diff --git a/third_party/crashpad/crashpad/tools/crashpad_database_util.cc b/third_party/crashpad/crashpad/tools/crashpad_database_util.cc
index e7d89bc438ceb9aef32bbcccbcb3917f699605b6..b2c4cb497cb0eb688ce05011790e92f8b084ce87 100644
--- a/third_party/crashpad/crashpad/tools/crashpad_database_util.cc
+++ b/third_party/crashpad/crashpad/tools/crashpad_database_util.cc
@@ -560,13 +560,21 @@ int DatabaseUtilMain(int argc, char* argv[]) {
return EXIT_FAILURE;
}
+ bool used_stdin = false;
for (const base::FilePath new_report_path : options.new_report_paths) {
std::unique_ptr<FileReaderInterface> file_reader;
- bool is_stdin = false;
if (new_report_path.value() == FILE_PATH_LITERAL("-")) {
- is_stdin = true;
- file_reader.reset(new WeakStdioFileReader(stdin));
+ if (used_stdin) {
+ fprintf(stderr,
+ "%" PRFilePath
+ ": Only one --new-report may be read from standard input\n",
+ me.value().c_str());
+ return EXIT_FAILURE;
+ }
+ used_stdin = true;
+ file_reader.reset(new WeakFileHandleFileReader(
+ StdioFileHandle(StdioStream::kStandardInput)));
} else {
std::unique_ptr<FileReader> file_path_reader(new FileReader());
if (!file_path_reader->Open(new_report_path)) {
@@ -597,7 +605,7 @@ int DatabaseUtilMain(int argc, char* argv[]) {
!LoggingWriteFile(new_report->handle, buf, read_result)) {
return EXIT_FAILURE;
}
- } while (read_result == sizeof(buf));
+ } while (read_result > 0);
call_error_writing_crash_report.Disarm();
@@ -607,13 +615,6 @@ int DatabaseUtilMain(int argc, char* argv[]) {
return EXIT_FAILURE;
}
- file_reader.reset();
- if (is_stdin) {
- if (fclose(stdin) == EOF) {
- STDIO_PLOG(ERROR) << "fclose";
- }
- }
-
const char* prefix = (show_operations > 1) ? "New report ID: " : "";
printf("%s%s\n", prefix, uuid.ToString().c_str());
}
« no previous file with comments | « third_party/crashpad/crashpad/third_party/gtest/gmock.gyp ('k') | third_party/crashpad/crashpad/tools/crashpad_http_upload.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698