From 0a37901b9f83f75579634afcc3dc8eb1b4a116ce Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Tue, 24 Jan 2017 15:20:42 -0800 Subject: [PATCH] crash_dump: properly dump when we can't talk to tombstoned. Bug: http://b/32466479 Test: stop tombstoned; logcat -c; crasher; logcat Change-Id: I16c010cc1865b4e1db8d2b85c904a2e074f28f1f --- debuggerd/crash_dump.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debuggerd/crash_dump.cpp b/debuggerd/crash_dump.cpp index e4f88b0fa..c14593393 100644 --- a/debuggerd/crash_dump.cpp +++ b/debuggerd/crash_dump.cpp @@ -284,6 +284,7 @@ int main(int argc, char** argv) { } else { unique_fd devnull(TEMP_FAILURE_RETRY(open("/dev/null", O_RDWR))); TEMP_FAILURE_RETRY(dup2(devnull.get(), STDOUT_FILENO)); + output_fd = std::move(devnull); } LOG(INFO) << "performing dump of process " << target << " (target tid = " << main_tid << ")"; @@ -395,7 +396,7 @@ int main(int argc, char** argv) { // Close stdout before we notify tombstoned of completion. close(STDOUT_FILENO); - if (!tombstoned_notify_completion(tombstoned_socket.get())) { + if (tombstoned_connected && !tombstoned_notify_completion(tombstoned_socket.get())) { LOG(ERROR) << "failed to notify tombstoned of completion"; }