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-native.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-native.c')
-rw-r--r-- | src/journal/journald-native.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index 6b2edc191d..a19f85d182 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -336,7 +336,7 @@ void server_process_native_file( r = readlink_malloc(sl, &k); if (r < 0) { - log_error("readlink(%s) failed: %m", sl); + log_error_errno(errno, "readlink(%s) failed: %m", sl); return; } @@ -357,7 +357,7 @@ void server_process_native_file( } if (fstat(fd, &st) < 0) { - log_error("Failed to stat passed file, ignoring: %m"); + log_error_errno(errno, "Failed to stat passed file, ignoring: %m"); return; } @@ -383,7 +383,7 @@ void server_process_native_file( ps = PAGE_ALIGN(st.st_size); p = mmap(NULL, ps, PROT_READ, MAP_PRIVATE, fd, 0); if (p == MAP_FAILED) { - log_error("Failed to map memfd, ignoring: %m"); + log_error_errno(errno, "Failed to map memfd, ignoring: %m"); return; } @@ -425,7 +425,7 @@ int server_open_native_socket(Server*s) { s->native_fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0); if (s->native_fd < 0) { - log_error("socket() failed: %m"); + log_error_errno(errno, "socket() failed: %m"); return -errno; } @@ -433,7 +433,7 @@ int server_open_native_socket(Server*s) { r = bind(s->native_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; } @@ -443,7 +443,7 @@ int server_open_native_socket(Server*s) { r = setsockopt(s->native_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; } @@ -451,13 +451,13 @@ int server_open_native_socket(Server*s) { if (mac_selinux_use()) { r = setsockopt(s->native_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->native_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; } |