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/shared/ask-password-api.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/shared/ask-password-api.c')
-rw-r--r-- | src/shared/ask-password-api.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c index 94a27f9010..41049d79bd 100644 --- a/src/shared/ask-password-api.c +++ b/src/shared/ask-password-api.c @@ -259,7 +259,7 @@ static int create_socket(char **name) { fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0); if (fd < 0) { - log_error("socket() failed: %m"); + log_error_errno(errno, "socket() failed: %m"); return -errno; } @@ -271,13 +271,13 @@ static int create_socket(char **name) { if (r < 0) { r = -errno; - log_error("bind(%s) failed: %m", sa.un.sun_path); + log_error_errno(errno, "bind(%s) failed: %m", sa.un.sun_path); goto fail; } if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)) < 0) { r = -errno; - log_error("SO_PASSCRED failed: %m"); + log_error_errno(errno, "SO_PASSCRED failed: %m"); goto fail; } @@ -330,7 +330,7 @@ int ask_password_agent( fd = mkostemp_safe(temp, O_WRONLY|O_CLOEXEC); if (fd < 0) { - log_error("Failed to create password file: %m"); + log_error_errno(errno, "Failed to create password file: %m"); r = -errno; goto finish; } @@ -339,7 +339,7 @@ int ask_password_agent( f = fdopen(fd, "w"); if (!f) { - log_error("Failed to allocate FILE: %m"); + log_error_errno(errno, "Failed to allocate FILE: %m"); r = -errno; goto finish; } @@ -348,7 +348,7 @@ int ask_password_agent( signal_fd = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); if (signal_fd < 0) { - log_error("signalfd(): %m"); + log_error_errno(errno, "signalfd(): %m"); r = -errno; goto finish; } @@ -384,7 +384,7 @@ int ask_password_agent( fflush(f); if (ferror(f)) { - log_error("Failed to write query file: %m"); + log_error_errno(errno, "Failed to write query file: %m"); r = -errno; goto finish; } @@ -396,7 +396,7 @@ int ask_password_agent( final[sizeof(final)-9] = 'k'; if (rename(temp, final) < 0) { - log_error("Failed to rename query file: %m"); + log_error_errno(errno, "Failed to rename query file: %m"); r = -errno; goto finish; } @@ -433,7 +433,7 @@ int ask_password_agent( if (errno == EINTR) continue; - log_error("poll() failed: %m"); + log_error_errno(errno, "poll() failed: %m"); r = -errno; goto finish; } @@ -472,7 +472,7 @@ int ask_password_agent( errno == EINTR) continue; - log_error("recvmsg() failed: %m"); + log_error_errno(errno, "recvmsg() failed: %m"); r = -errno; goto finish; } |