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
This commit is contained in:
Elliott Hughes 2023-03-03 23:46:34 +00:00
parent 8dd531cef9
commit ae1c64ac92

View file

@ -884,7 +884,7 @@ wint_t getwchar() {
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, ...) {