summaryrefslogtreecommitdiff
path: root/src/socket-proxy
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 11:58:34 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 12:04:41 +0100
commit0a1beeb64207eaa88ab9236787b1cbc2f704ae14 (patch)
tree50117277be2e2078d0373b944a30b4f09bb94443 /src/socket-proxy
parentb4d23205f238e06aaa31264628e20669e714acad (diff)
downloadsystemd-0a1beeb64207eaa88ab9236787b1cbc2f704ae14.tar.gz
treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
Diffstat (limited to 'src/socket-proxy')
-rw-r--r--src/socket-proxy/socket-proxyd.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c
index 3041903757..bac7393a5f 100644
--- a/src/socket-proxy/socket-proxyd.c
+++ b/src/socket-proxy/socket-proxyd.c
@@ -266,7 +266,7 @@ static int connection_enable_event_sources(Connection *c) {
r = 0;
if (r < 0) {
- log_error("Failed to set up server event source: %s", strerror(-r));
+ log_error_errno(-r, "Failed to set up server event source: %m");
return r;
}
@@ -278,7 +278,7 @@ static int connection_enable_event_sources(Connection *c) {
r = 0;
if (r < 0) {
- log_error("Failed to set up client event source: %s", strerror(-r));
+ log_error_errno(-r, "Failed to set up client event source: %m");
return r;
}
@@ -357,13 +357,13 @@ static int connection_start(Connection *c, struct sockaddr *sa, socklen_t salen)
if (errno == EINPROGRESS) {
r = sd_event_add_io(c->context->event, &c->client_event_source, c->client_fd, EPOLLOUT, connect_cb, c);
if (r < 0) {
- log_error("Failed to add connection socket: %s", strerror(-r));
+ log_error_errno(-r, "Failed to add connection socket: %m");
goto fail;
}
r = sd_event_source_set_enabled(c->client_event_source, SD_EVENT_ONESHOT);
if (r < 0) {
- log_error("Failed to enable oneshot event source: %s", strerror(-r));
+ log_error_errno(-r, "Failed to enable oneshot event source: %m");
goto fail;
}
} else {
@@ -449,7 +449,7 @@ static int resolve_remote(Connection *c) {
log_debug("Looking up address info for %s:%s", node, service);
r = sd_resolve_getaddrinfo(c->context->resolve, &c->resolve_query, node, service, &hints, resolve_cb, c);
if (r < 0) {
- log_error("Failed to resolve remote host: %s", strerror(-r));
+ log_error_errno(-r, "Failed to resolve remote host: %m");
goto fail;
}
@@ -521,14 +521,14 @@ static int accept_cb(sd_event_source *s, int fd, uint32_t revents, void *userdat
r = add_connection_socket(context, nfd);
if (r < 0) {
- log_error("Failed to accept connection, ignoring: %s", strerror(-r));
+ log_error_errno(-r, "Failed to accept connection, ignoring: %m");
safe_close(fd);
}
}
r = sd_event_source_set_enabled(s, SD_EVENT_ONESHOT);
if (r < 0) {
- log_error("Error while re-enabling listener with ONESHOT: %s", strerror(-r));
+ log_error_errno(-r, "Error while re-enabling listener with ONESHOT: %m");
sd_event_exit(context->event, r);
return r;
}
@@ -551,7 +551,7 @@ static int add_listen_socket(Context *context, int fd) {
r = sd_is_socket(fd, 0, SOCK_STREAM, 1);
if (r < 0) {
- log_error("Failed to determine socket type: %s", strerror(-r));
+ log_error_errno(-r, "Failed to determine socket type: %m");
return r;
}
if (r == 0) {
@@ -561,19 +561,19 @@ static int add_listen_socket(Context *context, int fd) {
r = fd_nonblock(fd, true);
if (r < 0) {
- log_error("Failed to mark file descriptor non-blocking: %s", strerror(-r));
+ log_error_errno(-r, "Failed to mark file descriptor non-blocking: %m");
return r;
}
r = sd_event_add_io(context->event, &source, fd, EPOLLIN, accept_cb, context);
if (r < 0) {
- log_error("Failed to add event source: %s", strerror(-r));
+ log_error_errno(-r, "Failed to add event source: %m");
return r;
}
r = set_put(context->listen, source);
if (r < 0) {
- log_error("Failed to add source to set: %s", strerror(-r));
+ log_error_errno(-r, "Failed to add source to set: %m");
sd_event_source_unref(source);
return r;
}
@@ -582,7 +582,7 @@ static int add_listen_socket(Context *context, int fd) {
* watching to accept(). */
r = sd_event_source_set_enabled(source, SD_EVENT_ONESHOT);
if (r < 0) {
- log_error("Failed to enable oneshot mode: %s", strerror(-r));
+ log_error_errno(-r, "Failed to enable oneshot mode: %m");
return r;
}
@@ -663,19 +663,19 @@ int main(int argc, char *argv[]) {
r = sd_event_default(&context.event);
if (r < 0) {
- log_error("Failed to allocate event loop: %s", strerror(-r));
+ log_error_errno(-r, "Failed to allocate event loop: %m");
goto finish;
}
r = sd_resolve_default(&context.resolve);
if (r < 0) {
- log_error("Failed to allocate resolver: %s", strerror(-r));
+ log_error_errno(-r, "Failed to allocate resolver: %m");
goto finish;
}
r = sd_resolve_attach_event(context.resolve, context.event, 0);
if (r < 0) {
- log_error("Failed to attach resolver: %s", strerror(-r));
+ log_error_errno(-r, "Failed to attach resolver: %m");
goto finish;
}
@@ -700,7 +700,7 @@ int main(int argc, char *argv[]) {
r = sd_event_loop(context.event);
if (r < 0) {
- log_error("Failed to run event loop: %s", strerror(-r));
+ log_error_errno(-r, "Failed to run event loop: %m");
goto finish;
}