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-remote/journal-remote.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-remote/journal-remote.c')
-rw-r--r-- | src/journal-remote/journal-remote.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 78385538b4..06a39920e4 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -85,7 +85,7 @@ static int spawn_child(const char* child, char** argv) { int r; if (pipe(fd) < 0) { - log_error("Failed to create pager pipe: %m"); + log_error_errno(errno, "Failed to create pager pipe: %m"); return -errno; } @@ -94,7 +94,7 @@ static int spawn_child(const char* child, char** argv) { child_pid = fork(); if (child_pid < 0) { r = -errno; - log_error("Failed to fork: %m"); + log_error_errno(errno, "Failed to fork: %m"); safe_close_pair(fd); return r; } @@ -103,7 +103,7 @@ static int spawn_child(const char* child, char** argv) { if (child_pid == 0) { r = dup2(fd[1], STDOUT_FILENO); if (r < 0) { - log_error("Failed to dup pipe to stdout: %m"); + log_error_errno(errno, "Failed to dup pipe to stdout: %m"); _exit(EXIT_FAILURE); } @@ -119,13 +119,13 @@ static int spawn_child(const char* child, char** argv) { _exit(EXIT_SUCCESS); execvp(child, argv); - log_error("Failed to exec child %s: %m", child); + log_error_errno(errno, "Failed to exec child %s: %m", child); _exit(EXIT_FAILURE); } r = close(fd[1]); if (r < 0) - log_warning("Failed to close write end of pipe: %m"); + log_warning_errno(errno, "Failed to close write end of pipe: %m"); return fd[0]; } @@ -140,7 +140,7 @@ static int spawn_curl(const char* url) { r = spawn_child("curl", argv); if (r < 0) - log_error("Failed to spawn curl: %m"); + log_error_errno(errno, "Failed to spawn curl: %m"); return r; } @@ -159,7 +159,7 @@ static int spawn_getter(const char *getter, const char *url) { r = spawn_child(words[0], words); if (r < 0) - log_error("Failed to spawn getter %s: %m", getter); + log_error_errno(errno, "Failed to spawn getter %s: %m", getter); return r; } @@ -941,7 +941,7 @@ static int remoteserver_init(RemoteServer *s, fd = open(*file, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NONBLOCK); if (fd < 0) { - log_error("Failed to open %s: %m", *file); + log_error_errno(errno, "Failed to open %s: %m", *file); return -errno; } output_name = *file; @@ -1054,7 +1054,7 @@ static int accept_connection(const char* type, int fd, log_debug("Accepting new %s connection on fd:%d", type, fd); fd2 = accept4(fd, &addr->sockaddr.sa, &addr->size, SOCK_NONBLOCK|SOCK_CLOEXEC); if (fd2 < 0) { - log_error("accept() on fd:%d failed: %m", fd); + log_error_errno(errno, "accept() on fd:%d failed: %m", fd); return -errno; } |