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:
parent
8dd531cef9
commit
ae1c64ac92
1 changed files with 1 additions and 1 deletions
|
@ -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, ...) {
|
||||
|
|
Loading…
Reference in a new issue