diff options
Diffstat (limited to 'src/journal-remote')
-rw-r--r-- | src/journal-remote/journal-remote.c | 1 | ||||
-rw-r--r-- | src/journal-remote/journal-upload.c | 23 |
2 files changed, 15 insertions, 9 deletions
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 1baedf6367..e3bd76051b 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -1114,6 +1114,7 @@ static int accept_connection(const char* type, int fd, r = socknameinfo_pretty(&addr->sockaddr, addr->size, &b); if (r < 0) { + log_error_errno(r, "Resolving hostname failed: %m"); close(fd2); return r; } diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index 5d23639ee8..172fd80a12 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -126,26 +126,31 @@ static int update_cursor_state(Uploader *u) { r = fopen_temporary(u->state_file, &f, &temp_path); if (r < 0) - goto finish; + goto fail; fprintf(f, "# This is private data. Do not parse.\n" "LAST_CURSOR=%s\n", u->last_cursor); - fflush(f); + r = fflush_and_check(f); + if (r < 0) + goto fail; - if (ferror(f) || rename(temp_path, u->state_file) < 0) { + if (rename(temp_path, u->state_file) < 0) { r = -errno; - unlink(u->state_file); - unlink(temp_path); + goto fail; } -finish: - if (r < 0) - log_error_errno(r, "Failed to save state %s: %m", u->state_file); + return 0; - return r; +fail: + if (temp_path) + (void) unlink(temp_path); + + (void) unlink(u->state_file); + + return log_error_errno(r, "Failed to save state %s: %m", u->state_file); } static int load_cursor_state(Uploader *u) { |