support Android's logging system for fatal_error
This commit is contained in:
7
util.c
7
util.c
@ -4,6 +4,10 @@
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include <async_safe/log.h>
|
||||
#endif
|
||||
|
||||
#include "util.h"
|
||||
|
||||
static int write_full(int fd, const char *buf, size_t length) {
|
||||
@ -27,5 +31,8 @@ COLD noreturn void fatal_error(const char *s) {
|
||||
(void)(write_full(STDERR_FILENO, prefix, strlen(prefix)) != -1 &&
|
||||
write_full(STDERR_FILENO, s, strlen(s)) != -1 &&
|
||||
write_full(STDERR_FILENO, "\n", 1));
|
||||
#ifdef __ANDROID__
|
||||
async_safe_format_log(ANDROID_LOG_FATAL, "hardened_malloc", "fatal allocator error: %s", s);
|
||||
#endif
|
||||
abort();
|
||||
}
|
||||
|
Reference in New Issue
Block a user