diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 19:29:59 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 19:49:27 +0100 |
commit | 56f64d95763a799ba4475daf44d8e9f72a1bd474 (patch) | |
tree | 4c38253c718dc1972b811fa7c01ebfa3c2b7776c /src/journal/journald-syslog.c | |
parent | 895b3a7b44fe7ca2f260986be2a877ff56a72718 (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-syslog.c')
-rw-r--r-- | src/journal/journald-syslog.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c index 45483eff36..51ebd8192d 100644 --- a/src/journal/journald-syslog.c +++ b/src/journal/journald-syslog.c @@ -106,7 +106,7 @@ static void forward_syslog_iovec(Server *s, const struct iovec *iovec, unsigned } if (errno != ENOENT) - log_debug("Failed to forward syslog message: %m"); + log_debug_errno(errno, "Failed to forward syslog message: %m"); } static void forward_syslog_raw(Server *s, int priority, const char *buffer, const struct ucred *ucred, const struct timeval *tv) { @@ -429,7 +429,7 @@ int server_open_syslog_socket(Server *s) { s->syslog_fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0); if (s->syslog_fd < 0) { - log_error("socket() failed: %m"); + log_error_errno(errno, "socket() failed: %m"); return -errno; } @@ -437,7 +437,7 @@ int server_open_syslog_socket(Server *s) { r = bind(s->syslog_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path)); if (r < 0) { - log_error("bind(%s) failed: %m", sa.un.sun_path); + log_error_errno(errno, "bind(%s) failed: %m", sa.un.sun_path); return -errno; } @@ -447,7 +447,7 @@ int server_open_syslog_socket(Server *s) { r = setsockopt(s->syslog_fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)); if (r < 0) { - log_error("SO_PASSCRED failed: %m"); + log_error_errno(errno, "SO_PASSCRED failed: %m"); return -errno; } @@ -455,13 +455,13 @@ int server_open_syslog_socket(Server *s) { if (mac_selinux_use()) { r = setsockopt(s->syslog_fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one)); if (r < 0) - log_warning("SO_PASSSEC failed: %m"); + log_warning_errno(errno, "SO_PASSSEC failed: %m"); } #endif r = setsockopt(s->syslog_fd, SOL_SOCKET, SO_TIMESTAMP, &one, sizeof(one)); if (r < 0) { - log_error("SO_TIMESTAMP failed: %m"); + log_error_errno(errno, "SO_TIMESTAMP failed: %m"); return -errno; } |