if (nbtot <= sizeof(buf))
len = nbtot;
if (syscall(SYS_getrandom, buf, len, 0) == -1)
- ERROR_EXIT("getrandom() failed: %s\n", strerror(errno));
+ ERROR_EXIT("getrandom() failed: %m\n");
if (write(STDOUT_FILENO, buf, len) != len)
- ERROR_EXIT("write() failed: %s\n", strerror(errno));
+ ERROR_EXIT("write() failed: %m\n");
nbtot -= sizeof(buf);
}
l = log_list(count, NULL);
if (stream) {
if (pipe(fds) == -1) {
- fprintf(stderr, "logd: failed to create pipe: %s\n", strerror(errno));
+ fprintf(stderr, "logd: failed to create pipe: %m\n");
return -1;
}
{
sender.fd = usock((log_udp) ? (USOCK_UDP) : (USOCK_TCP), log_ip, log_port);
if (sender.fd < 0) {
- fprintf(stderr, "failed to connect: %s\n", strerror(errno));
+ fprintf(stderr, "failed to connect: %m\n");
uloop_timeout_set(&retry, 1000);
} else {
uloop_fd_add(&sender, ULOOP_READ);
}
sender.fd = open(log_file, O_CREAT | O_WRONLY | O_APPEND, 0600);
if (sender.fd < 0) {
- fprintf(stderr, "failed to open %s: %s\n", log_file, strerror(errno));
+ fprintf(stderr, "failed to open %s: %m\n", log_file);
exit(-1);
}
}
log_type = LOG_FILE;
sender.fd = open(log_file, O_CREAT | O_WRONLY| O_APPEND, 0600);
if (sender.fd < 0) {
- fprintf(stderr, "failed to open %s: %s\n", log_file, strerror(errno));
+ fprintf(stderr, "failed to open %s: %m\n", log_file);
exit(-1);
}
} else {