diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 18:23:20 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 18:24:30 +0100 |
commit | 23bbb0de4e3f85d9704a5c12a5afa2dfa0159e41 (patch) | |
tree | 28e66fb86dd0cffc3a3cca3cf234cb52c3b64ad3 /src/journal-remote | |
parent | 5e03c6e3b517286bbd65b48d88f60e5b83721894 (diff) |
treewide: more log_*_errno + return simplifications
Diffstat (limited to 'src/journal-remote')
-rw-r--r-- | src/journal-remote/journal-gatewayd.c | 18 | ||||
-rw-r--r-- | src/journal-remote/journal-remote.c | 32 | ||||
-rw-r--r-- | src/journal-remote/microhttpd-util.c | 12 |
3 files changed, 21 insertions, 41 deletions
diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c index 723b057c1d..d39a2cc67e 100644 --- a/src/journal-remote/journal-gatewayd.c +++ b/src/journal-remote/journal-gatewayd.c @@ -909,10 +909,8 @@ static int parse_argv(int argc, char *argv[]) { return -EINVAL; } r = read_full_file(optarg, &key_pem, NULL); - if (r < 0) { - log_error_errno(r, "Failed to read key file: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to read key file: %m"); assert(key_pem); break; @@ -922,10 +920,8 @@ static int parse_argv(int argc, char *argv[]) { return -EINVAL; } r = read_full_file(optarg, &cert_pem, NULL); - if (r < 0) { - log_error_errno(r, "Failed to read certificate file: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to read certificate file: %m"); assert(cert_pem); break; @@ -936,10 +932,8 @@ static int parse_argv(int argc, char *argv[]) { return -EINVAL; } r = read_full_file(optarg, &trust_pem, NULL); - if (r < 0) { - log_error_errno(r, "Failed to read CA certificate file: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to read CA certificate file: %m"); assert(trust_pem); break; #else diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 21309743fe..32e2d33e99 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -150,16 +150,12 @@ static int spawn_getter(const char *getter, const char *url) { assert(getter); r = strv_split_quoted(&words, getter, false); - if (r < 0) { - log_error_errno(r, "Failed to split getter option: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to split getter option: %m"); r = strv_extend(&words, url); - if (r < 0) { - log_error_errno(r, "Failed to create command line: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to create command line: %m"); r = spawn_child(words[0], words); if (r < 0) @@ -836,10 +832,8 @@ static int remoteserver_init(RemoteServer *s, } r = sd_event_default(&s->events); - if (r < 0) { - log_error_errno(r, "Failed to allocate event loop: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to allocate event loop: %m"); setup_signals(s); @@ -875,10 +869,8 @@ static int remoteserver_init(RemoteServer *s, char *hostname; r = getnameinfo_pretty(fd, &hostname); - if (r < 0) { - log_error_errno(r, "Failed to retrieve remote name: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to retrieve remote name: %m"); log_info("Received a connection socket (fd:%d) from %s", fd, hostname); @@ -889,11 +881,9 @@ static int remoteserver_init(RemoteServer *s, return -EINVAL; } - if(r < 0) { - log_error_errno(r, "Failed to register socket (fd:%d): %m", - fd); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to register socket (fd:%d): %m", + fd); } if (arg_url) { diff --git a/src/journal-remote/microhttpd-util.c b/src/journal-remote/microhttpd-util.c index 03a594cffb..277e125403 100644 --- a/src/journal-remote/microhttpd-util.c +++ b/src/journal-remote/microhttpd-util.c @@ -170,17 +170,13 @@ static int verify_cert_authorized(gnutls_session_t session) { int r; r = gnutls_certificate_verify_peers2(session, &status); - if (r < 0) { - log_error_errno(r, "gnutls_certificate_verify_peers2 failed: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "gnutls_certificate_verify_peers2 failed: %m"); type = gnutls_certificate_type_get(session); r = gnutls_certificate_verification_status_print(status, type, &out, 0); - if (r < 0) { - log_error_errno(r, "gnutls_certificate_verification_status_print failed: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "gnutls_certificate_verification_status_print failed: %m"); log_info("Certificate status: %s", out.data); |