mirror of
https://github.com/fluencelabs/musl
synced 2025-05-21 19:51:31 +00:00
23 lines
343 B
C
23 lines
343 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
#include "stdio_impl.h"
|
|
|
|
void perror(const char *msg)
|
|
{
|
|
FILE *f = stderr;
|
|
char *errstr = strerror(errno);
|
|
|
|
FLOCK(f);
|
|
|
|
if (msg && *msg) {
|
|
fwrite(msg, strlen(msg), 1, f);
|
|
fputc(':', f);
|
|
fputc(' ', f);
|
|
}
|
|
fwrite(errstr, strlen(errstr), 1, f);
|
|
fputc('\n', f);
|
|
|
|
FUNLOCK(f);
|
|
}
|