summaryrefslogtreecommitdiff
path: root/src/socket-proxy
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/socket-proxy
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/socket-proxy')
-rw-r--r--src/socket-proxy/socket-proxyd.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c
index ca59311662..a2507ad456 100644
--- a/src/socket-proxy/socket-proxyd.c
+++ b/src/socket-proxy/socket-proxyd.c
@@ -121,7 +121,7 @@ static int connection_create_pipes(Connection *c, int buffer[2], size_t *sz) {
r = pipe2(buffer, O_CLOEXEC|O_NONBLOCK);
if (r < 0) {
- log_error("Failed to allocate pipe buffer: %m");
+ log_error_errno(errno, "Failed to allocate pipe buffer: %m");
return -errno;
}
@@ -129,7 +129,7 @@ static int connection_create_pipes(Connection *c, int buffer[2], size_t *sz) {
r = fcntl(buffer[0], F_GETPIPE_SZ);
if (r < 0) {
- log_error("Failed to get pipe buffer size: %m");
+ log_error_errno(errno, "Failed to get pipe buffer size: %m");
return -errno;
}
@@ -172,7 +172,7 @@ static int connection_shovel(
*from_source = sd_event_source_unref(*from_source);
*from = safe_close(*from);
} else if (errno != EAGAIN && errno != EINTR) {
- log_error("Failed to splice: %m");
+ log_error_errno(errno, "Failed to splice: %m");
return -errno;
}
}
@@ -186,7 +186,7 @@ static int connection_shovel(
*to_source = sd_event_source_unref(*to_source);
*to = safe_close(*to);
} else if (errno != EAGAIN && errno != EINTR) {
- log_error("Failed to splice: %m");
+ log_error_errno(errno, "Failed to splice: %m");
return -errno;
}
}
@@ -317,7 +317,7 @@ static int connect_cb(sd_event_source *s, int fd, uint32_t revents, void *userda
solen = sizeof(error);
r = getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &solen);
if (r < 0) {
- log_error("Failed to issue SO_ERROR: %m");
+ log_error_errno(errno, "Failed to issue SO_ERROR: %m");
goto fail;
}
@@ -344,7 +344,7 @@ static int connection_start(Connection *c, struct sockaddr *sa, socklen_t salen)
c->client_fd = socket(sa->sa_family, SOCK_STREAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0);
if (c->client_fd < 0) {
- log_error("Failed to get remote socket: %m");
+ log_error_errno(errno, "Failed to get remote socket: %m");
goto fail;
}
@@ -363,7 +363,7 @@ static int connection_start(Connection *c, struct sockaddr *sa, socklen_t salen)
goto fail;
}
} else {
- log_error("Failed to connect to remote host: %m");
+ log_error_errno(errno, "Failed to connect to remote host: %m");
goto fail;
}
} else {
@@ -510,7 +510,7 @@ static int accept_cb(sd_event_source *s, int fd, uint32_t revents, void *userdat
nfd = accept4(fd, NULL, NULL, SOCK_NONBLOCK|SOCK_CLOEXEC);
if (nfd < 0) {
if (errno != -EAGAIN)
- log_warning("Failed to accept() socket: %m");
+ log_warning_errno(errno, "Failed to accept() socket: %m");
} else {
getpeername_pretty(nfd, &peer);
log_debug("New connection from %s", strna(peer));