am 75fcd01a: am e9731387: Merge "__libc_fatal should print a newline to stderr."

* commit '75fcd01a6ecdee67f55751557ebceb0f31a73682':
  __libc_fatal should print a newline to stderr.
This commit is contained in:
Dan Albert
2014-07-21 19:24:27 +00:00
committed by Android Git Automerger

View File

@@ -620,7 +620,11 @@ static void __libc_fatal(const char* format, va_list args) {
out_vformat(os, format, args); out_vformat(os, format, args);
// log to stderr for the benefit of "adb shell" users. // log to stderr for the benefit of "adb shell" users.
write(2, msg, strlen(msg)); struct iovec iov[2] = {
{msg, strlen(msg)},
{const_cast<void*>(static_cast<const void*>("\n")), 1},
};
writev(2, iov, 2);
// Log to the log for the benefit of regular app developers (whose stdout and stderr are closed). // 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); __libc_write_log(ANDROID_LOG_FATAL, "libc", msg);