diff options
Diffstat (limited to 'src/journal-remote')
-rw-r--r-- | src/journal-remote/journal-remote-parse.c | 4 | ||||
-rw-r--r-- | src/journal-remote/journal-remote-write.c | 6 | ||||
-rw-r--r-- | src/journal-remote/journal-remote.c | 39 | ||||
-rw-r--r-- | src/journal-remote/journal-upload-journal.c | 10 | ||||
-rw-r--r-- | src/journal-remote/journal-upload.c | 21 |
5 files changed, 37 insertions, 43 deletions
diff --git a/src/journal-remote/journal-remote-parse.c b/src/journal-remote/journal-remote-parse.c index 7dd8878ca6..47ff368e6c 100644 --- a/src/journal-remote/journal-remote-parse.c +++ b/src/journal-remote/journal-remote-parse.c @@ -451,8 +451,8 @@ int process_source(RemoteSource *source, bool compress, bool seal) { r = writer_write(source->writer, &source->iovw, &source->ts, compress, seal); if (r < 0) - log_error("Failed to write entry of %zu bytes: %s", - iovw_size(&source->iovw), strerror(-r)); + log_error_errno(r, "Failed to write entry of %zu bytes: %m", + iovw_size(&source->iovw)); else r = 1; diff --git a/src/journal-remote/journal-remote-write.c b/src/journal-remote/journal-remote-write.c index bfb6a7dcb8..df30049397 100644 --- a/src/journal-remote/journal-remote-write.c +++ b/src/journal-remote/journal-remote-write.c @@ -59,11 +59,9 @@ static int do_rotate(JournalFile **f, bool compress, bool seal) { int r = journal_file_rotate(f, compress, seal); if (r < 0) { if (*f) - log_error("Failed to rotate %s: %s", (*f)->path, - strerror(-r)); + log_error_errno(r, "Failed to rotate %s: %m", (*f)->path); else - log_error("Failed to create rotated journal: %s", - strerror(-r)); + log_error_errno(r, "Failed to create rotated journal: %m"); } return r; diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 89a680dcb7..d1df83fba0 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -210,8 +210,8 @@ static int open_output(Writer *w, const char* host) { w->mmap, NULL, &w->journal); if (r < 0) - log_error("Failed to open output journal %s: %s", - output, strerror(-r)); + log_error_errno(r, "Failed to open output journal %s: %m", + output); else log_info("Opened output file %s", w->journal->path); return r; @@ -321,8 +321,8 @@ static int get_source_for_fd(RemoteServer *s, r = get_writer(s, name, &writer); if (r < 0) { - log_warning("Failed to get writer for source %s: %s", - name, strerror(-r)); + log_warning_errno(r, "Failed to get writer for source %s: %m", + name); return r; } @@ -376,8 +376,8 @@ static int add_source(RemoteServer *s, int fd, char* name, bool own_name) { r = get_source_for_fd(s, fd, name, &source); if (r < 0) { - log_error("Failed to create source for fd:%d (%s): %s", - fd, name, strerror(-r)); + log_error_errno(r, "Failed to create source for fd:%d (%s): %m", + fd, name); free(name); return r; } @@ -393,8 +393,8 @@ static int add_source(RemoteServer *s, int fd, char* name, bool own_name) { sd_event_source_set_enabled(source->event, SD_EVENT_ON); } if (r < 0) { - log_error("Failed to register event source for fd:%d: %s", - fd, strerror(-r)); + log_error_errno(r, "Failed to register event source for fd:%d: %m", + fd); goto error; } @@ -460,8 +460,8 @@ static int request_meta(void **connection_cls, int fd, char *hostname) { r = get_writer(server, hostname, &writer); if (r < 0) { - log_warning("Failed to get writer for source %s: %s", - hostname, strerror(-r)); + log_warning_errno(r, "Failed to get writer for source %s: %m", + hostname); return r; } @@ -856,8 +856,7 @@ static int remoteserver_init(RemoteServer *s, n = sd_listen_fds(true); if (n < 0) { - log_error("Failed to read listening file descriptors from environment: %s", - strerror(-n)); + log_error_errno(n, "Failed to read listening file descriptors from environment: %m"); return n; } else log_info("Received %d descriptors", n); @@ -896,8 +895,8 @@ static int remoteserver_init(RemoteServer *s, } if(r < 0) { - log_error("Failed to register socket (fd:%d): %s", - fd, strerror(-r)); + log_error_errno(r, "Failed to register socket (fd:%d): %m", + fd); return r; } } @@ -1462,15 +1461,15 @@ static int load_certificates(char **key, char **cert, char **trust) { r = read_full_file(arg_key ?: PRIV_KEY_FILE, key, NULL); if (r < 0) { - log_error("Failed to read key from file '%s': %s", - arg_key ?: PRIV_KEY_FILE, strerror(-r)); + log_error_errno(r, "Failed to read key from file '%s': %m", + arg_key ?: PRIV_KEY_FILE); return r; } r = read_full_file(arg_cert ?: CERT_FILE, cert, NULL); if (r < 0) { - log_error("Failed to read certificate from file '%s': %s", - arg_cert ?: CERT_FILE, strerror(-r)); + log_error_errno(r, "Failed to read certificate from file '%s': %m", + arg_cert ?: CERT_FILE); return r; } @@ -1479,8 +1478,8 @@ static int load_certificates(char **key, char **cert, char **trust) { else { r = read_full_file(arg_trust ?: TRUST_FILE, trust, NULL); if (r < 0) { - log_error("Failed to read CA certificate file '%s': %s", - arg_trust ?: TRUST_FILE, strerror(-r)); + log_error_errno(r, "Failed to read CA certificate file '%s': %m", + arg_trust ?: TRUST_FILE); return r; } } diff --git a/src/journal-remote/journal-upload-journal.c b/src/journal-remote/journal-upload-journal.c index ace31af0bf..6e5e45f7c9 100644 --- a/src/journal-remote/journal-upload-journal.c +++ b/src/journal-remote/journal-upload-journal.c @@ -134,8 +134,7 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) { &u->field_data, &u->field_length); if (r < 0) { - log_error("Failed to move to next field in entry: %s", - strerror(-r)); + log_error_errno(r, "Failed to move to next field in entry: %m"); return r; } else if (r == 0) { u->entry_state = ENTRY_OUTRO; @@ -250,8 +249,7 @@ static size_t journal_input_callback(void *buf, size_t size, size_t nmemb, void if (u->entry_state == ENTRY_DONE) { r = sd_journal_next(j); if (r < 0) { - log_error("Failed to move to next entry in journal: %s", - strerror(-r)); + log_error_errno(r, "Failed to move to next entry in journal: %m"); return CURL_READFUNC_ABORT; } else if (r == 0) { if (u->input_event) @@ -392,8 +390,8 @@ int open_journal_for_upload(Uploader *u, if (cursor) { r = sd_journal_seek_cursor(j, cursor); if (r < 0) { - log_error("Failed to seek to cursor %s: %s", - cursor, strerror(-r)); + log_error_errno(r, "Failed to seek to cursor %s: %m", + cursor); return r; } } diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index 0b9a817b23..e677e13348 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -87,8 +87,8 @@ static size_t output_callback(char *buf, if (nmemb && !u->answer) { u->answer = strndup(buf, size*nmemb); if (!u->answer) - log_warning("Failed to store server answer (%zu bytes): %s", - size*nmemb, strerror(ENOMEM)); + log_warning_errno(ENOMEM, "Failed to store server answer (%zu bytes): %m", + size*nmemb); } return size * nmemb; @@ -104,15 +104,15 @@ static int check_cursor_updating(Uploader *u) { r = mkdir_parents(u->state_file, 0755); if (r < 0) { - log_error("Cannot create parent directory of state file %s: %s", - u->state_file, strerror(-r)); + log_error_errno(r, "Cannot create parent directory of state file %s: %m", + u->state_file); return r; } r = fopen_temporary(u->state_file, &f, &temp_path); if (r < 0) { - log_error("Cannot save state to %s: %s", - u->state_file, strerror(-r)); + log_error_errno(r, "Cannot save state to %s: %m", + u->state_file); return r; } unlink(temp_path); @@ -165,8 +165,8 @@ static int load_cursor_state(Uploader *u) { if (r == -ENOENT) log_debug("State file %s is not present.", u->state_file); else if (r < 0) { - log_error("Failed to read state file %s: %s", - u->state_file, strerror(-r)); + log_error_errno(r, "Failed to read state file %s: %m", + u->state_file); return r; } else log_debug("Last cursor was %s", u->last_cursor); @@ -786,9 +786,8 @@ static int open_journal(sd_journal **j) { else r = sd_journal_open(j, !arg_merge*SD_JOURNAL_LOCAL_ONLY + arg_journal_type); if (r < 0) - log_error("Failed to open %s: %s", - arg_directory ? arg_directory : arg_file ? "files" : "journal", - strerror(-r)); + log_error_errno(r, "Failed to open %s: %m", + arg_directory ? arg_directory : arg_file ? "files" : "journal"); return r; } |