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/pthread_attr.cpp b/libc/bionic/pthread_attr.cpp
index cdae72c..de4cc9e 100644
--- a/libc/bionic/pthread_attr.cpp
+++ b/libc/bionic/pthread_attr.cpp
@@ -158,12 +158,12 @@
static uintptr_t __get_main_stack_startstack() {
FILE* fp = fopen("/proc/self/stat", "re");
if (fp == nullptr) {
- async_safe_fatal("couldn't open /proc/self/stat: %s", strerror(errno));
+ async_safe_fatal("couldn't open /proc/self/stat: %m");
}
char line[BUFSIZ];
if (fgets(line, sizeof(line), fp) == nullptr) {
- async_safe_fatal("couldn't read /proc/self/stat: %s", strerror(errno));
+ async_safe_fatal("couldn't read /proc/self/stat: %m");
}
fclose(fp);
@@ -205,7 +205,7 @@
// Hunt for the region that contains that address.
FILE* fp = fopen("/proc/self/maps", "re");
if (fp == nullptr) {
- async_safe_fatal("couldn't open /proc/self/maps: %s", strerror(errno));
+ async_safe_fatal("couldn't open /proc/self/maps: %m");
}
char line[BUFSIZ];
while (fgets(line, sizeof(line), fp) != nullptr) {
@@ -219,7 +219,7 @@
}
}
}
- async_safe_fatal("Stack not found in /proc/self/maps");
+ async_safe_fatal("stack not found in /proc/self/maps");
}
__BIONIC_WEAK_FOR_NATIVE_BRIDGE