Consistently use %m rather than strerror() in logging.
When I added %m to async_safe_* too, we never followed up and cleaned up
callers.
Test: treehugger
Change-Id: If81943c4c45de49f0fb4bc29cfbd3fc53d4a47fe
diff --git a/libc/bionic/atexit.cpp b/libc/bionic/atexit.cpp
index dae15e0..29f9c7b 100644
--- a/libc/bionic/atexit.cpp
+++ b/libc/bionic/atexit.cpp
@@ -158,7 +158,7 @@
const int prot = PROT_READ | (writable ? PROT_WRITE : 0);
if (mprotect(reinterpret_cast<char*>(array_) + start_byte, byte_len, prot) != 0) {
- async_safe_fatal("mprotect failed on atexit array: %s", strerror(errno));
+ async_safe_fatal("mprotect failed on atexit array: %m");
}
}
@@ -198,8 +198,8 @@
}
if (new_pages == MAP_FAILED) {
async_safe_format_log(ANDROID_LOG_WARN, "libc",
- "__cxa_atexit: mmap/mremap failed to allocate %zu bytes: %s",
- new_capacity_bytes, strerror(errno));
+ "__cxa_atexit: mmap/mremap failed to allocate %zu bytes: %m",
+ new_capacity_bytes);
} else {
result = true;
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, new_pages, new_capacity_bytes, "atexit handlers");