Slightly simplify perror().
Using %m is slightly less code, and means that perror() wouldn't touch
the strerror buffer in TLS. Doesn't matter, but noticed while I was
looking at this for another reason, and since it's _less_ code...
Test: treehugger
Change-Id: I99d31a5c326962958ad843ec4da2c3cc3b93b048
diff --git a/libc/stdio/stdio.cpp b/libc/stdio/stdio.cpp
index 4f12fd0..645aefa 100644
--- a/libc/stdio/stdio.cpp
+++ b/libc/stdio/stdio.cpp
@@ -884,7 +884,7 @@
void perror(const char* msg) {
if (msg == nullptr) msg = "";
- fprintf(stderr, "%s%s%s\n", msg, (*msg == '\0') ? "" : ": ", strerror(errno));
+ fprintf(stderr, "%s%s%m\n", msg, (*msg == '\0') ? "" : ": ");
}
int printf(const char* fmt, ...) {