diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 18:50:43 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 18:56:16 +0100 |
commit | f647962d64e844689f3e2acfce6102fc47e76df2 (patch) | |
tree | dcaf5e38de1d4e31f73f540bc85532ceb72cfa6b /src/socket-proxy/socket-proxyd.c | |
parent | e80733be33e52d8ab2f1ae845326d39c600f5612 (diff) |
treewide: yet more log_*_errno + return simplifications
Using:
find . -name '*.[ch]' | while read f; do perl -i.mmm -e \
'local $/;
local $_=<>;
s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg;
print;'
$f
done
And a couple of manual whitespace fixups.
Diffstat (limited to 'src/socket-proxy/socket-proxyd.c')
-rw-r--r-- | src/socket-proxy/socket-proxyd.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c index eba285bba6..ca59311662 100644 --- a/src/socket-proxy/socket-proxyd.c +++ b/src/socket-proxy/socket-proxyd.c @@ -265,10 +265,8 @@ static int connection_enable_event_sources(Connection *c) { else r = 0; - if (r < 0) { - log_error_errno(r, "Failed to set up server event source: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to set up server event source: %m"); if (c->client_event_source) r = sd_event_source_set_io_events(c->client_event_source, b); @@ -277,10 +275,8 @@ static int connection_enable_event_sources(Connection *c) { else r = 0; - if (r < 0) { - log_error_errno(r, "Failed to set up client event source: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to set up client event source: %m"); return 0; } @@ -550,26 +546,20 @@ static int add_listen_socket(Context *context, int fd) { } r = sd_is_socket(fd, 0, SOCK_STREAM, 1); - if (r < 0) { - log_error_errno(r, "Failed to determine socket type: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to determine socket type: %m"); if (r == 0) { log_error("Passed in socket is not a stream socket."); return -EINVAL; } r = fd_nonblock(fd, true); - if (r < 0) { - log_error_errno(r, "Failed to mark file descriptor non-blocking: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to mark file descriptor non-blocking: %m"); r = sd_event_add_io(context->event, &source, fd, EPOLLIN, accept_cb, context); - if (r < 0) { - log_error_errno(r, "Failed to add event source: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to add event source: %m"); r = set_put(context->listen, source); if (r < 0) { @@ -581,10 +571,8 @@ static int add_listen_socket(Context *context, int fd) { /* Set the watcher to oneshot in case other processes are also * watching to accept(). */ r = sd_event_source_set_enabled(source, SD_EVENT_ONESHOT); - if (r < 0) { - log_error_errno(r, "Failed to enable oneshot mode: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to enable oneshot mode: %m"); return 0; } |