From 1dd1b88bdee77b32d316de2a9a2ed52856f75483 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Sun, 20 Jul 2014 11:49:46 -0700 Subject: [PATCH] __libc_fatal should print a newline to stderr. Change-Id: I088dc880d7488a65beac8cda95f530f3db41f112 (cherry picked from commit 97e31dedf056b07bcfcd46c49b60bf0798c60843) --- libc/bionic/libc_logging.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libc/bionic/libc_logging.cpp b/libc/bionic/libc_logging.cpp index e656a1255..d0172edaa 100644 --- a/libc/bionic/libc_logging.cpp +++ b/libc/bionic/libc_logging.cpp @@ -620,7 +620,11 @@ static void __libc_fatal(const char* format, va_list args) { out_vformat(os, format, args); // log to stderr for the benefit of "adb shell" users. - write(2, msg, strlen(msg)); + struct iovec iov[2] = { + {msg, strlen(msg)}, + {const_cast(static_cast("\n")), 1}, + }; + writev(2, iov, 2); // Log to the log for the benefit of regular app developers (whose stdout and stderr are closed). __libc_write_log(ANDROID_LOG_FATAL, "libc", msg);