summaryrefslogtreecommitdiff
path: root/src/journal/journald-kmsg.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 19:29:59 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 19:49:27 +0100
commit56f64d95763a799ba4475daf44d8e9f72a1bd474 (patch)
tree4c38253c718dc1972b811fa7c01ebfa3c2b7776c /src/journal/journald-kmsg.c
parent895b3a7b44fe7ca2f260986be2a877ff56a72718 (diff)
treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
Diffstat (limited to 'src/journal/journald-kmsg.c')
-rw-r--r--src/journal/journald-kmsg.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
index 363c5de869..aca4571ece 100644
--- a/src/journal/journald-kmsg.c
+++ b/src/journal/journald-kmsg.c
@@ -88,7 +88,7 @@ void server_forward_kmsg(
IOVEC_SET_STRING(iovec[n++], "\n");
if (writev(s->dev_kmsg_fd, iovec, n) < 0)
- log_debug("Failed to write to /dev/kmsg for logging: %m");
+ log_debug_errno(errno, "Failed to write to /dev/kmsg for logging: %m");
free(ident_buf);
}
@@ -342,7 +342,7 @@ static int server_read_dev_kmsg(Server *s) {
if (errno == EAGAIN || errno == EINTR || errno == EPIPE)
return 0;
- log_error("Failed to read from kernel: %m");
+ log_error_errno(errno, "Failed to read from kernel: %m");
return -errno;
}
@@ -446,18 +446,18 @@ int server_open_kernel_seqnum(Server *s) {
fd = open("/run/systemd/journal/kernel-seqnum", O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW, 0644);
if (fd < 0) {
- log_error("Failed to open /run/systemd/journal/kernel-seqnum, ignoring: %m");
+ log_error_errno(errno, "Failed to open /run/systemd/journal/kernel-seqnum, ignoring: %m");
return 0;
}
if (posix_fallocate(fd, 0, sizeof(uint64_t)) < 0) {
- log_error("Failed to allocate sequential number file, ignoring: %m");
+ log_error_errno(errno, "Failed to allocate sequential number file, ignoring: %m");
return 0;
}
p = mmap(NULL, sizeof(uint64_t), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (p == MAP_FAILED) {
- log_error("Failed to map sequential number file, ignoring: %m");
+ log_error_errno(errno, "Failed to map sequential number file, ignoring: %m");
return 0;
}