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/journald-server.c | |
parent | 5e03c6e3b517286bbd65b48d88f60e5b83721894 (diff) |
treewide: more log_*_errno + return simplifications
Diffstat (limited to 'src/journal/journald-server.c')
-rw-r--r-- | src/journal/journald-server.c | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 4f5d002d21..3d1947f25f 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -927,10 +927,8 @@ static int system_journal_open(Server *s, bool flush_requested) { char ids[33]; r = sd_id128_get_machine(&machine); - if (r < 0) { - log_error_errno(r, "Failed to get machine id: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to get machine id: %m"); sd_id128_to_string(machine, ids); @@ -999,10 +997,8 @@ static int system_journal_open(Server *s, bool flush_requested) { r = journal_file_open_reliably(fn, O_RDWR|O_CREAT, 0640, s->compress, false, &s->runtime_metrics, s->mmap, NULL, &s->runtime_journal); free(fn); - if (r < 0) { - log_error_errno(r, "Failed to open runtime journal: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to open runtime journal: %m"); } if (s->runtime_journal) @@ -1045,10 +1041,8 @@ int server_flush_to_var(Server *s) { return r; r = sd_journal_open(&j, SD_JOURNAL_RUNTIME_ONLY); - if (r < 0) { - log_error_errno(r, "Failed to read runtime journal: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to read runtime journal: %m"); sd_journal_set_data_threshold(j, 0); @@ -1453,15 +1447,12 @@ static int server_open_hostname(Server *s) { return 0; } - log_error_errno(r, "Failed to register hostname fd in event loop: %m"); - return r; + return log_error_errno(r, "Failed to register hostname fd in event loop: %m"); } r = sd_event_source_set_priority(s->hostname_event_source, SD_EVENT_PRIORITY_IMPORTANT-10); - if (r < 0) { - log_error_errno(r, "Failed to adjust priority of host name event source: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to adjust priority of host name event source: %m"); return 0; } @@ -1514,18 +1505,14 @@ int server_init(Server *s) { return log_oom(); r = sd_event_default(&s->event); - if (r < 0) { - log_error_errno(r, "Failed to create event loop: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to create event loop: %m"); sd_event_set_watchdog(s->event, true); n = sd_listen_fds(true); - if (n < 0) { - log_error_errno(n, "Failed to read listening file descriptors from environment: %m"); - return n; - } + if (n < 0) + return log_error_errno(n, "Failed to read listening file descriptors from environment: %m"); for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd++) { |