summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/cat.c4
-rw-r--r--src/journal/catalog.c6
-rw-r--r--src/journal/coredump.c12
-rw-r--r--src/journal/coredumpctl.c24
-rw-r--r--src/journal/journalctl.c66
-rw-r--r--src/journal/journald-audit.c8
-rw-r--r--src/journal/journald-kmsg.c4
-rw-r--r--src/journal/journald-native.c4
-rw-r--r--src/journal/journald-server.c42
-rw-r--r--src/journal/journald-stream.c8
-rw-r--r--src/journal/journald-syslog.c2
-rw-r--r--src/journal/journald-wall.c2
-rw-r--r--src/journal/journald.c2
-rw-r--r--src/journal/sd-journal.c12
-rw-r--r--src/journal/test-compress.c4
15 files changed, 100 insertions, 100 deletions
diff --git a/src/journal/cat.c b/src/journal/cat.c
index 955c85b4f9..98f3d87b91 100644
--- a/src/journal/cat.c
+++ b/src/journal/cat.c
@@ -134,7 +134,7 @@ int main(int argc, char *argv[]) {
fd = sd_journal_stream_fd(arg_identifier, arg_priority, arg_level_prefix);
if (fd < 0) {
- log_error_errno(-fd, "Failed to create stream fd: %m");
+ log_error_errno(fd, "Failed to create stream fd: %m");
r = fd;
goto finish;
}
@@ -164,7 +164,7 @@ int main(int argc, char *argv[]) {
if (saved_stderr >= 0)
dup3(saved_stderr, STDERR_FILENO, 0);
- log_error_errno(-r, "Failed to execute process: %m");
+ log_error_errno(r, "Failed to execute process: %m");
finish:
safe_close(fd);
diff --git a/src/journal/catalog.c b/src/journal/catalog.c
index bcb3258cee..f16e28a7a8 100644
--- a/src/journal/catalog.c
+++ b/src/journal/catalog.c
@@ -342,7 +342,7 @@ static long write_catalog(const char *database, Hashmap *h, struct strbuf *sb,
r = mkdir_p(d, 0775);
if (r < 0) {
- log_error_errno(-r, "Recursive mkdir %s: %m", d);
+ log_error_errno(r, "Recursive mkdir %s: %m", d);
return r;
}
@@ -422,7 +422,7 @@ int catalog_update(const char* database, const char* root, const char* const* di
r = conf_files_list_strv(&files, ".catalog", root, dirs);
if (r < 0) {
- log_error_errno(-r, "Failed to get catalog files: %m");
+ log_error_errno(r, "Failed to get catalog files: %m");
goto finish;
}
@@ -463,7 +463,7 @@ int catalog_update(const char* database, const char* root, const char* const* di
r = write_catalog(database, h, sb, items, n);
if (r < 0)
- log_error_errno(-r, "Failed to write %s: %m", database);
+ log_error_errno(r, "Failed to write %s: %m", database);
else
log_debug("%s: wrote %u items, with %zu bytes of strings, %ld total size.",
database, n, sb->len, r);
diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index af155b487f..32fa7be0aa 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -313,7 +313,7 @@ static int save_external_coredump(
r = make_filename(info, &fn);
if (r < 0) {
- log_error_errno(-r, "Failed to determine coredump file name: %m");
+ log_error_errno(r, "Failed to determine coredump file name: %m");
return r;
}
@@ -337,7 +337,7 @@ static int save_external_coredump(
log_error("Not enough disk space for coredump of %s (%s), refusing.", info[INFO_PID], info[INFO_COMM]);
goto fail;
} else if (r < 0) {
- log_error_errno(-r, "Failed to dump coredump to file: %m");
+ log_error_errno(r, "Failed to dump coredump to file: %m");
goto fail;
}
@@ -379,7 +379,7 @@ static int save_external_coredump(
r = compress_stream(fd, fd_compressed, -1);
if (r < 0) {
- log_error_errno(-r, "Failed to compress %s: %m", tmp_compressed);
+ log_error_errno(r, "Failed to compress %s: %m", tmp_compressed);
goto fail_compressed;
}
@@ -446,7 +446,7 @@ static int allocate_journal_field(int fd, size_t size, char **ret, size_t *ret_s
n = read(fd, field + 9, size);
if (n < 0) {
- log_error_errno(-n, "Failed to read core data: %m");
+ log_error_errno(n, "Failed to read core data: %m");
return (int) n;
}
if ((size_t) n < size) {
@@ -841,7 +841,7 @@ int main(int argc, char* argv[]) {
else if (r == -EINVAL)
log_warning("Failed to generate stack trace: %s", dwfl_errmsg(dwfl_errno()));
else
- log_warning_errno(-r, "Failed to generate stack trace: %m");
+ log_warning_errno(r, "Failed to generate stack trace: %m");
}
if (!core_message)
@@ -868,7 +868,7 @@ log:
r = sd_journal_sendv(iovec, j);
if (r < 0)
- log_error_errno(-r, "Failed to log coredump: %m");
+ log_error_errno(r, "Failed to log coredump: %m");
finish:
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index 81b5462a41..b82c6f4530 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -73,7 +73,7 @@ static Set *new_matches(void) {
r = set_consume(set, tmp);
if (r < 0) {
- log_error_errno(-r, "failed to add to set: %m");
+ log_error_errno(r, "failed to add to set: %m");
set_free(set);
return NULL;
}
@@ -110,13 +110,13 @@ static int add_match(Set *set, const char *match) {
log_debug("Adding pattern: %s", pattern);
r = set_consume(set, pattern);
if (r < 0) {
- log_error_errno(-r, "Failed to add pattern: %m");
+ log_error_errno(r, "Failed to add pattern: %m");
goto fail;
}
return 0;
fail:
- log_error_errno(-r, "Failed to add match: %m");
+ log_error_errno(r, "Failed to add match: %m");
return r;
}
@@ -327,7 +327,7 @@ static int print_list(FILE* file, sd_journal *j, int had_legend) {
r = sd_journal_get_realtime_usec(j, &t);
if (r < 0) {
- log_error_errno(-r, "Failed to get realtime timestamp: %m");
+ log_error_errno(r, "Failed to get realtime timestamp: %m");
return r;
}
@@ -522,7 +522,7 @@ static int focus(sd_journal *j) {
if (r == 0)
r = sd_journal_previous(j);
if (r < 0) {
- log_error_errno(-r, "Failed to search journal: %m");
+ log_error_errno(r, "Failed to search journal: %m");
return r;
}
if (r == 0) {
@@ -586,7 +586,7 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
* compressed file (probably uncached). */
r = sd_journal_get_data(j, "COREDUMP_FILENAME", (const void**) &data, &len);
if (r < 0 && r != -ENOENT)
- log_warning_errno(-r, "Failed to retrieve COREDUMP_FILENAME: %m");
+ log_warning_errno(r, "Failed to retrieve COREDUMP_FILENAME: %m");
else if (r == 0)
retrieve(data, len, "COREDUMP_FILENAME", &filename);
@@ -655,7 +655,7 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
r = decompress_stream(filename, fdf, fd, -1);
if (r < 0) {
- log_error_errno(-r, "Failed to decompress %s: %m", filename);
+ log_error_errno(r, "Failed to decompress %s: %m", filename);
goto error;
}
#else
@@ -667,7 +667,7 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
if (r == -ENOENT)
log_error("Cannot retrieve coredump from journal nor disk.");
else
- log_error_errno(-r, "Failed to retrieve COREDUMP field: %m");
+ log_error_errno(r, "Failed to retrieve COREDUMP field: %m");
goto error;
}
@@ -705,7 +705,7 @@ static int dump_core(sd_journal* j) {
r = save_core(j, output ? fileno(output) : STDOUT_FILENO, NULL, NULL);
if (r < 0) {
- log_error_errno(-r, "Coredump retrieval failed: %m");
+ log_error_errno(r, "Coredump retrieval failed: %m");
return r;
}
@@ -736,7 +736,7 @@ static int run_gdb(sd_journal *j) {
r = sd_journal_get_data(j, "COREDUMP_EXE", (const void**) &data, &len);
if (r < 0) {
- log_error_errno(-r, "Failed to retrieve COREDUMP_EXE field: %m");
+ log_error_errno(r, "Failed to retrieve COREDUMP_EXE field: %m");
return r;
}
@@ -760,7 +760,7 @@ static int run_gdb(sd_journal *j) {
r = save_core(j, -1, &path, &unlink_path);
if (r < 0) {
- log_error_errno(-r, "Failed to retrieve core: %m");
+ log_error_errno(r, "Failed to retrieve core: %m");
return r;
}
@@ -820,7 +820,7 @@ int main(int argc, char *argv[]) {
r = sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY);
if (r < 0) {
- log_error_errno(-r, "Failed to open journal: %m");
+ log_error_errno(r, "Failed to open journal: %m");
goto end;
}
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 89fb89f0e6..6077b6e1a2 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -502,7 +502,7 @@ static int parse_argv(int argc, char *argv[]) {
case ARG_FILE:
r = glob_extend(&arg_file, optarg);
if (r < 0) {
- log_error_errno(-r, "Failed to add paths: %m");
+ log_error_errno(r, "Failed to add paths: %m");
return r;
};
break;
@@ -750,7 +750,7 @@ static int generate_new_id128(void) {
r = sd_id128_randomize(&id);
if (r < 0) {
- log_error_errno(-r, "Failed to generate ID: %m");
+ log_error_errno(r, "Failed to generate ID: %m");
return r;
}
@@ -852,7 +852,7 @@ static int add_matches(sd_journal *j, char **args) {
}
if (r < 0) {
- log_error_errno(-r, "Failed to add match '%s': %m", *i);
+ log_error_errno(r, "Failed to add match '%s': %m", *i);
return r;
}
}
@@ -1030,7 +1030,7 @@ static int add_boot(sd_journal *j) {
r = get_boot_id_by_offset(j, &arg_boot_id, arg_boot_offset);
if (r < 0) {
if (sd_id128_equal(arg_boot_id, SD_ID128_NULL))
- log_error_errno(-r, "Failed to look up boot %+i: %m", arg_boot_offset);
+ log_error_errno(r, "Failed to look up boot %+i: %m", arg_boot_offset);
else
log_error("Failed to look up boot ID "SD_ID128_FORMAT_STR"%+i: %s",
SD_ID128_FORMAT_VAL(arg_boot_id), arg_boot_offset, strerror(-r));
@@ -1041,7 +1041,7 @@ static int add_boot(sd_journal *j) {
r = sd_journal_add_match(j, match, sizeof(match) - 1);
if (r < 0) {
- log_error_errno(-r, "Failed to add match: %m");
+ log_error_errno(r, "Failed to add match: %m");
return r;
}
@@ -1061,7 +1061,7 @@ static int add_dmesg(sd_journal *j) {
r = sd_journal_add_match(j, "_TRANSPORT=kernel", strlen("_TRANSPORT=kernel"));
if (r < 0) {
- log_error_errno(-r, "Failed to add match: %m");
+ log_error_errno(r, "Failed to add match: %m");
return r;
}
@@ -1264,7 +1264,7 @@ static int add_priorities(sd_journal *j) {
r = sd_journal_add_match(j, match, strlen(match));
if (r < 0) {
- log_error_errno(-r, "Failed to add match: %m");
+ log_error_errno(r, "Failed to add match: %m");
return r;
}
}
@@ -1328,13 +1328,13 @@ static int setup_keys(void) {
r = sd_id128_get_machine(&machine);
if (r < 0) {
- log_error_errno(-r, "Failed to get machine ID: %m");
+ log_error_errno(r, "Failed to get machine ID: %m");
return r;
}
r = sd_id128_get_boot(&boot);
if (r < 0) {
- log_error_errno(-r, "Failed to get boot ID: %m");
+ log_error_errno(r, "Failed to get boot ID: %m");
return r;
}
@@ -1683,7 +1683,7 @@ static int flush_to_var(void) {
* daemon and set up inotify to wait for the flushed file to appear */
r = bus_open_system_systemd(&bus);
if (r < 0) {
- log_error_errno(-r, "Failed to get D-Bus connection: %m");
+ log_error_errno(r, "Failed to get D-Bus connection: %m");
return r;
}
@@ -1726,13 +1726,13 @@ static int flush_to_var(void) {
r = fd_wait_for_event(watch_fd, POLLIN, USEC_INFINITY);
if (r < 0) {
- log_error_errno(-r, "Failed to wait for event: %m");
+ log_error_errno(r, "Failed to wait for event: %m");
return r;
}
r = flush_fd(watch_fd);
if (r < 0) {
- log_error_errno(-r, "Failed to flush inotify events: %m");
+ log_error_errno(r, "Failed to flush inotify events: %m");
return r;
}
}
@@ -1789,7 +1789,7 @@ int main(int argc, char *argv[]) {
if (arg_action == ACTION_UPDATE_CATALOG) {
r = catalog_update(database, arg_root, catalog_file_dirs);
if (r < 0)
- log_error_errno(-r, "Failed to list catalog: %m");
+ log_error_errno(r, "Failed to list catalog: %m");
} else {
bool oneline = arg_action == ACTION_LIST_CATALOG;
@@ -1799,7 +1799,7 @@ int main(int argc, char *argv[]) {
else
r = catalog_list(stdout, database, oneline);
if (r < 0)
- log_error_errno(-r, "Failed to list catalog: %m");
+ log_error_errno(r, "Failed to list catalog: %m");
}
goto finish;
@@ -1859,7 +1859,7 @@ int main(int argc, char *argv[]) {
q = journal_directory_vacuum(d->path, arg_vacuum_size, arg_vacuum_time, NULL, true);
if (q < 0) {
- log_error_errno(-q, "Failed to vacuum: %m");
+ log_error_errno(q, "Failed to vacuum: %m");
r = q;
}
}
@@ -1887,25 +1887,25 @@ int main(int argc, char *argv[]) {
strv_free(arg_user_units);
if (r < 0) {
- log_error_errno(-r, "Failed to add filter for units: %m");
+ log_error_errno(r, "Failed to add filter for units: %m");
return EXIT_FAILURE;
}
r = add_syslog_identifier(j);
if (r < 0) {
- log_error_errno(-r, "Failed to add filter for syslog identifiers: %m");
+ log_error_errno(r, "Failed to add filter for syslog identifiers: %m");
return EXIT_FAILURE;
}
r = add_priorities(j);
if (r < 0) {
- log_error_errno(-r, "Failed to add filter for priorities: %m");
+ log_error_errno(r, "Failed to add filter for priorities: %m");
return EXIT_FAILURE;
}
r = add_matches(j, argv + optind);
if (r < 0) {
- log_error_errno(-r, "Failed to add filters: %m");
+ log_error_errno(r, "Failed to add filters: %m");
return EXIT_FAILURE;
}
@@ -1928,7 +1928,7 @@ int main(int argc, char *argv[]) {
r = sd_journal_query_unique(j, arg_field);
if (r < 0) {
- log_error_errno(-r, "Failed to query unique data objects: %m");
+ log_error_errno(r, "Failed to query unique data objects: %m");
return EXIT_FAILURE;
}
@@ -1960,7 +1960,7 @@ int main(int argc, char *argv[]) {
if (arg_cursor || arg_after_cursor) {
r = sd_journal_seek_cursor(j, arg_cursor ?: arg_after_cursor);
if (r < 0) {
- log_error_errno(-r, "Failed to seek to cursor: %m");
+ log_error_errno(r, "Failed to seek to cursor: %m");
return EXIT_FAILURE;
}
if (!arg_reverse)
@@ -1975,7 +1975,7 @@ int main(int argc, char *argv[]) {
} else if (arg_since_set && !arg_reverse) {
r = sd_journal_seek_realtime_usec(j, arg_since);
if (r < 0) {
- log_error_errno(-r, "Failed to seek to date: %m");
+ log_error_errno(r, "Failed to seek to date: %m");
return EXIT_FAILURE;
}
r = sd_journal_next(j);
@@ -1983,7 +1983,7 @@ int main(int argc, char *argv[]) {
} else if (arg_until_set && arg_reverse) {
r = sd_journal_seek_realtime_usec(j, arg_until);
if (r < 0) {
- log_error_errno(-r, "Failed to seek to date: %m");
+ log_error_errno(r, "Failed to seek to date: %m");
return EXIT_FAILURE;
}
r = sd_journal_previous(j);
@@ -1991,7 +1991,7 @@ int main(int argc, char *argv[]) {
} else if (arg_lines >= 0) {
r = sd_journal_seek_tail(j);
if (r < 0) {
- log_error_errno(-r, "Failed to seek to tail: %m");
+ log_error_errno(r, "Failed to seek to tail: %m");
return EXIT_FAILURE;
}
@@ -2000,7 +2000,7 @@ int main(int argc, char *argv[]) {
} else if (arg_reverse) {
r = sd_journal_seek_tail(j);
if (r < 0) {
- log_error_errno(-r, "Failed to seek to tail: %m");
+ log_error_errno(r, "Failed to seek to tail: %m");
return EXIT_FAILURE;
}
@@ -2009,7 +2009,7 @@ int main(int argc, char *argv[]) {
} else {
r = sd_journal_seek_head(j);
if (r < 0) {
- log_error_errno(-r, "Failed to seek to head: %m");
+ log_error_errno(r, "Failed to seek to head: %m");
return EXIT_FAILURE;
}
@@ -2017,7 +2017,7 @@ int main(int argc, char *argv[]) {
}
if (r < 0) {
- log_error_errno(-r, "Failed to iterate through journal: %m");
+ log_error_errno(r, "Failed to iterate through journal: %m");
return EXIT_FAILURE;
}
@@ -2030,7 +2030,7 @@ int main(int argc, char *argv[]) {
r = sd_journal_get_cutoff_realtime_usec(j, &start, &end);
if (r < 0) {
- log_error_errno(-r, "Failed to get cutoff: %m");
+ log_error_errno(r, "Failed to get cutoff: %m");
goto finish;
}
@@ -2055,7 +2055,7 @@ int main(int argc, char *argv[]) {
else
r = sd_journal_previous(j);
if (r < 0) {
- log_error_errno(-r, "Failed to iterate through journal: %m");
+ log_error_errno(r, "Failed to iterate through journal: %m");
goto finish;
}
if (r == 0)
@@ -2067,7 +2067,7 @@ int main(int argc, char *argv[]) {
r = sd_journal_get_realtime_usec(j, &usec);
if (r < 0) {
- log_error_errno(-r, "Failed to determine timestamp: %m");
+ log_error_errno(r, "Failed to determine timestamp: %m");
goto finish;
}
if (usec > arg_until)
@@ -2079,7 +2079,7 @@ int main(int argc, char *argv[]) {
r = sd_journal_get_realtime_usec(j, &usec);
if (r < 0) {
- log_error_errno(-r, "Failed to determine timestamp: %m");
+ log_error_errno(r, "Failed to determine timestamp: %m");
goto finish;
}
if (usec < arg_since)
@@ -2124,7 +2124,7 @@ int main(int argc, char *argv[]) {
r = sd_journal_get_cursor(j, &cursor);
if (r < 0 && r != -EADDRNOTAVAIL)
- log_error_errno(-r, "Failed to get cursor: %m");
+ log_error_errno(r, "Failed to get cursor: %m");
else if (r >= 0)
printf("-- cursor: %s\n", cursor);
}
@@ -2134,7 +2134,7 @@ int main(int argc, char *argv[]) {
r = sd_journal_wait(j, (uint64_t) -1);
if (r < 0) {
- log_error_errno(-r, "Couldn't wait for journal event: %m");
+ log_error_errno(r, "Couldn't wait for journal event: %m");
goto finish;
}
diff --git a/src/journal/journald-audit.c b/src/journal/journald-audit.c
index f7c7acadd5..bd985f0e9d 100644
--- a/src/journal/journald-audit.c
+++ b/src/journal/journald-audit.c
@@ -309,7 +309,7 @@ static int map_all_fields(
r = m->map(m->journal_field, &v, iov, n_iov_allocated, n_iov);
if (r < 0) {
- log_debug_errno(-r, "Failed to parse audit array: %m");
+ log_debug_errno(r, "Failed to parse audit array: %m");
return r;
}
@@ -323,7 +323,7 @@ static int map_all_fields(
if (!mapped) {
r = map_generic_field(prefix, &p, iov, n_iov_allocated, n_iov);
if (r < 0) {
- log_debug_errno(-r, "Failed to parse audit array: %m");
+ log_debug_errno(r, "Failed to parse audit array: %m");
return r;
}
@@ -548,14 +548,14 @@ int server_open_audit(Server *s) {
r = sd_event_add_io(s->event, &s->audit_event_source, s->audit_fd, EPOLLIN, process_datagram, s);
if (r < 0) {
- log_error_errno(-r, "Failed to add audit fd to event loop: %m");
+ log_error_errno(r, "Failed to add audit fd to event loop: %m");
return r;
}
/* We are listening now, try to enable audit */
r = enable_audit(s->audit_fd, true);
if (r < 0)
- log_warning_errno(-r, "Failed to issue audit enable call: %m");
+ log_warning_errno(r, "Failed to issue audit enable call: %m");
return 0;
}
diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
index 94866f10d3..363c5de869 100644
--- a/src/journal/journald-kmsg.c
+++ b/src/journal/journald-kmsg.c
@@ -413,13 +413,13 @@ int server_open_dev_kmsg(Server *s) {
goto fail;
}
- log_error_errno(-r, "Failed to add /dev/kmsg fd to event loop: %m");
+ log_error_errno(r, "Failed to add /dev/kmsg fd to event loop: %m");
goto fail;
}
r = sd_event_source_set_priority(s->dev_kmsg_event_source, SD_EVENT_PRIORITY_IMPORTANT+10);
if (r < 0) {
- log_error_errno(-r, "Failed to adjust priority of kmsg event source: %m");
+ log_error_errno(r, "Failed to adjust priority of kmsg event source: %m");
goto fail;
}
diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c
index 6bb3dcd25d..3b3908fb3e 100644
--- a/src/journal/journald-native.c
+++ b/src/journal/journald-native.c
@@ -405,7 +405,7 @@ void server_process_native_file(
n = pread(fd, p, st.st_size, 0);
if (n < 0)
- log_error_errno(-n, "Failed to read file, ignoring: %m");
+ log_error_errno(n, "Failed to read file, ignoring: %m");
else if (n > 0)
server_process_native_message(s, p, n, ucred, tv, label, label_len);
}
@@ -463,7 +463,7 @@ int server_open_native_socket(Server*s) {
r = sd_event_add_io(s->event, &s->native_event_source, s->native_fd, EPOLLIN, process_datagram, s);
if (r < 0) {
- log_error_errno(-r, "Failed to add native server fd to event loop: %m");
+ log_error_errno(r, "Failed to add native server fd to event loop: %m");
return r;
}
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index e2f433a5bb..f30a3c1392 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -204,7 +204,7 @@ void server_fix_perms(Server *s, JournalFile *f, uid_t uid) {
r = fchmod(f->fd, 0640);
if (r < 0)
- log_warning_errno(-r, "Failed to fix access mode on %s, ignoring: %m", f->path);
+ log_warning_errno(r, "Failed to fix access mode on %s, ignoring: %m", f->path);
#ifdef HAVE_ACL
if (uid <= SYSTEM_UID_MAX)
@@ -348,19 +348,19 @@ void server_sync(Server *s) {
if (s->system_journal) {
r = journal_file_set_offline(s->system_journal);
if (r < 0)
- log_error_errno(-r, "Failed to sync system journal: %m");
+ log_error_errno(r, "Failed to sync system journal: %m");
}
ORDERED_HASHMAP_FOREACH_KEY(f, k, s->user_journals, i) {
r = journal_file_set_offline(f);
if (r < 0)
- log_error_errno(-r, "Failed to sync user journal: %m");
+ log_error_errno(r, "Failed to sync user journal: %m");
}
if (s->sync_event_source) {
r = sd_event_source_set_enabled(s->sync_event_source, SD_EVENT_OFF);
if (r < 0)
- log_error_errno(-r, "Failed to disable sync timer source: %m");
+ log_error_errno(r, "Failed to disable sync timer source: %m");
}
s->sync_scheduled = false;
@@ -377,7 +377,7 @@ static void do_vacuum(Server *s, char *ids, JournalFile *f, const char* path,
p = strappenda(path, ids);
r = journal_directory_vacuum(p, metrics->max_use, s->max_retention_usec, &s->oldest_file_usec, false);
if (r < 0 && r != -ENOENT)
- log_error_errno(-r, "Failed to vacuum %s: %m", p);
+ log_error_errno(r, "Failed to vacuum %s: %m", p);
}
void server_vacuum(Server *s) {
@@ -391,7 +391,7 @@ void server_vacuum(Server *s) {
r = sd_id128_get_machine(&machine);
if (r < 0) {
- log_error_errno(-r, "Failed to get machine ID: %m");
+ log_error_errno(r, "Failed to get machine ID: %m");
return;
}
sd_id128_to_string(machine, ids);
@@ -511,7 +511,7 @@ static void write_to_journal(Server *s, uid_t uid, struct iovec *iovec, unsigned
for (i = 0; i < n; i++)
size += iovec[i].iov_len;
- log_error_errno(-r, "Failed to write entry (%d items, %zu bytes), ignoring: %m", n, size);
+ log_error_errno(r, "Failed to write entry (%d items, %zu bytes), ignoring: %m", n, size);
return;
}
@@ -530,7 +530,7 @@ static void write_to_journal(Server *s, uid_t uid, struct iovec *iovec, unsigned
for (i = 0; i < n; i++)
size += iovec[i].iov_len;
- log_error_errno(-r, "Failed to write entry (%d items, %zu bytes) despite vacuuming, ignoring: %m", n, size);
+ log_error_errno(r, "Failed to write entry (%d items, %zu bytes) despite vacuuming, ignoring: %m", n, size);
} else
server_schedule_sync(s, priority);
}
@@ -928,7 +928,7 @@ static int system_journal_open(Server *s, bool flush_requested) {
r = sd_id128_get_machine(&machine);
if (r < 0) {
- log_error_errno(-r, "Failed to get machine id: %m");
+ log_error_errno(r, "Failed to get machine id: %m");
return r;
}
@@ -958,7 +958,7 @@ static int system_journal_open(Server *s, bool flush_requested) {
server_fix_perms(s, s->system_journal, 0);
else if (r < 0) {
if (r != -ENOENT && r != -EROFS)
- log_warning_errno(-r, "Failed to open system journal: %m");
+ log_warning_errno(r, "Failed to open system journal: %m");
r = 0;
}
@@ -982,7 +982,7 @@ static int system_journal_open(Server *s, bool flush_requested) {
if (r < 0) {
if (r != -ENOENT)
- log_warning_errno(-r, "Failed to open runtime journal: %m");
+ log_warning_errno(r, "Failed to open runtime journal: %m");
r = 0;
}
@@ -1000,7 +1000,7 @@ static int system_journal_open(Server *s, bool flush_requested) {
free(fn);
if (r < 0) {
- log_error_errno(-r, "Failed to open runtime journal: %m");
+ log_error_errno(r, "Failed to open runtime journal: %m");
return r;
}
}
@@ -1046,7 +1046,7 @@ int server_flush_to_var(Server *s) {
r = sd_journal_open(&j, SD_JOURNAL_RUNTIME_ONLY);
if (r < 0) {
- log_error_errno(-r, "Failed to read runtime journal: %m");
+ log_error_errno(r, "Failed to read runtime journal: %m");
return r;
}
@@ -1063,7 +1063,7 @@ int server_flush_to_var(Server *s) {
r = journal_file_move_to_object(f, OBJECT_ENTRY, f->current_offset, &o);
if (r < 0) {
- log_error_errno(-r, "Can't read entry: %m");
+ log_error_errno(r, "Can't read entry: %m");
goto finish;
}
@@ -1072,7 +1072,7 @@ int server_flush_to_var(Server *s) {
continue;
if (!shall_try_append_again(s->system_journal, r)) {
- log_error_errno(-r, "Can't write entry: %m");
+ log_error_errno(r, "Can't write entry: %m");
goto finish;
}
@@ -1088,7 +1088,7 @@ int server_flush_to_var(Server *s) {
log_debug("Retrying write.");
r = journal_file_copy_entry(f, s->system_journal, o, f->current_offset, NULL, NULL, NULL);
if (r < 0) {
- log_error_errno(-r, "Can't write entry: %m");
+ log_error_errno(r, "Can't write entry: %m");
goto finish;
}
}
@@ -1311,7 +1311,7 @@ static int server_parse_proc_cmdline(Server *s) {
r = proc_cmdline(&line);
if (r < 0) {
- log_warning_errno(-r, "Failed to read /proc/cmdline, ignoring: %m");
+ log_warning_errno(r, "Failed to read /proc/cmdline, ignoring: %m");
return 0;
}
@@ -1453,13 +1453,13 @@ static int server_open_hostname(Server *s) {
return 0;
}
- log_error_errno(-r, "Failed to register hostname fd in event loop: %m");
+ log_error_errno(r, "Failed to register hostname fd in event loop: %m");
return r;
}
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");
+ log_error_errno(r, "Failed to adjust priority of host name event source: %m");
return r;
}
@@ -1515,7 +1515,7 @@ int server_init(Server *s) {
r = sd_event_default(&s->event);
if (r < 0) {
- log_error_errno(-r, "Failed to create event loop: %m");
+ log_error_errno(r, "Failed to create event loop: %m");
return r;
}
@@ -1523,7 +1523,7 @@ int server_init(Server *s) {
n = sd_listen_fds(true);
if (n < 0) {
- log_error_errno(-n, "Failed to read listening file descriptors from environment: %m");
+ log_error_errno(n, "Failed to read listening file descriptors from environment: %m");
return n;
}
diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c
index 580f746249..293006dc97 100644
--- a/src/journal/journald-stream.c
+++ b/src/journal/journald-stream.c
@@ -408,13 +408,13 @@ static int stdout_stream_new(sd_event_source *es, int listen_fd, uint32_t revent
r = sd_event_add_io(s->event, &stream->event_source, fd, EPOLLIN, stdout_stream_process, stream);
if (r < 0) {
- log_error_errno(-r, "Failed to add stream to event loop: %m");
+ log_error_errno(r, "Failed to add stream to event loop: %m");
goto fail;
}
r = sd_event_source_set_priority(stream->event_source, SD_EVENT_PRIORITY_NORMAL+5);
if (r < 0) {
- log_error_errno(-r, "Failed to adjust stdout event source priority: %m");
+ log_error_errno(r, "Failed to adjust stdout event source priority: %m");
goto fail;
}
@@ -465,13 +465,13 @@ int server_open_stdout_socket(Server *s) {
r = sd_event_add_io(s->event, &s->stdout_event_source, s->stdout_fd, EPOLLIN, stdout_stream_new, s);
if (r < 0) {
- log_error_errno(-r, "Failed to add stdout server fd to event source: %m");
+ log_error_errno(r, "Failed to add stdout server fd to event source: %m");
return r;
}
r = sd_event_source_set_priority(s->stdout_event_source, SD_EVENT_PRIORITY_NORMAL+10);
if (r < 0) {
- log_error_errno(-r, "Failed to adjust priority of stdout server event source: %m");
+ log_error_errno(r, "Failed to adjust priority of stdout server event source: %m");
return r;
}
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c
index b95f5da70e..d7fa245721 100644
--- a/src/journal/journald-syslog.c
+++ b/src/journal/journald-syslog.c
@@ -467,7 +467,7 @@ int server_open_syslog_socket(Server *s) {
r = sd_event_add_io(s->event, &s->syslog_event_source, s->syslog_fd, EPOLLIN, process_datagram, s);
if (r < 0) {
- log_error_errno(-r, "Failed to add syslog server fd to event loop: %m");
+ log_error_errno(r, "Failed to add syslog server fd to event loop: %m");
return r;
}
diff --git a/src/journal/journald-wall.c b/src/journal/journald-wall.c
index bb8ae8a85c..e3201674d4 100644
--- a/src/journal/journald-wall.c
+++ b/src/journal/journald-wall.c
@@ -65,5 +65,5 @@ void server_forward_wall(
r = utmp_wall(l, "systemd-journald", NULL);
if (r < 0)
- log_debug_errno(-r, "Failed to send wall message: %m");
+ log_debug_errno(r, "Failed to send wall message: %m");
}
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 09a832aaa6..604c8617bb 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -104,7 +104,7 @@ int main(int argc, char *argv[]) {
r = sd_event_run(server.event, t);
if (r < 0) {
- log_error_errno(-r, "Failed to run event loop: %m");
+ log_error_errno(r, "Failed to run event loop: %m");
goto finish;
}
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 390e5831e1..61e64f7f7c 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -884,7 +884,7 @@ static int real_journal_next(sd_journal *j, direction_t direction) {
r = next_beyond_location(j, f, direction, &o, &p);
if (r < 0) {
- log_debug_errno(-r, "Can't iterate through %s, ignoring: %m", f->path);
+ log_debug_errno(r, "Can't iterate through %s, ignoring: %m", f->path);
remove_file_real(j, f);
continue;
} else if (r == 0)
@@ -1567,7 +1567,7 @@ static int add_root_directory(sd_journal *j, const char *p) {
r = add_directory(j, m->path, de->d_name);
if (r < 0)
- log_debug_errno(-r, "Failed to add directory %s/%s: %m", m->path, de->d_name);
+ log_debug_errno(r, "Failed to add directory %s/%s: %m", m->path, de->d_name);
}
}
@@ -1810,7 +1810,7 @@ _public_ int sd_journal_open_files(sd_journal **ret, const char **paths, int fla
STRV_FOREACH(path, paths) {
r = add_any_file(j, *path);
if (r < 0) {
- log_error_errno(-r, "Failed to open %s: %m", *path);
+ log_error_errno(r, "Failed to open %s: %m", *path);
goto fail;
}
}
@@ -2227,7 +2227,7 @@ static void process_inotify_event(sd_journal *j, struct inotify_event *e) {
r = remove_file(j, d->path, e->name);
if (r < 0)
- log_debug_errno(-r, "Failed to remove file %s/%s: %m", d->path, e->name);
+ log_debug_errno(r, "Failed to remove file %s/%s: %m", d->path, e->name);
}
} else if (!d->is_root && e->len == 0) {
@@ -2237,7 +2237,7 @@ static void process_inotify_event(sd_journal *j, struct inotify_event *e) {
if (e->mask & (IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT)) {
r = remove_directory(j, d);
if (r < 0)
- log_debug_errno(-r, "Failed to remove directory %s: %m", d->path);
+ log_debug_errno(r, "Failed to remove directory %s: %m", d->path);
}
@@ -2248,7 +2248,7 @@ static void process_inotify_event(sd_journal *j, struct inotify_event *e) {
if (e->mask & (IN_CREATE|IN_MOVED_TO|IN_MODIFY|IN_ATTRIB)) {
r = add_directory(j, d->path, e->name);
if (r < 0)
- log_debug_errno(-r, "Failed to add directory %s/%s: %m", d->path, e->name);
+ log_debug_errno(r, "Failed to add directory %s/%s: %m", d->path, e->name);
}
}
diff --git a/src/journal/test-compress.c b/src/journal/test-compress.c
index 85b033ad34..dbf09d97c3 100644
--- a/src/journal/test-compress.c
+++ b/src/journal/test-compress.c
@@ -63,7 +63,7 @@ static void test_compress_decompress(int compression,
r = compress(data, data_len, compressed, &csize);
if (r == -ENOBUFS) {
- log_info_errno(-r, "compression failed: %m");
+ log_info_errno(r, "compression failed: %m");
assert(may_fail);
} else {
assert(r == 0);
@@ -108,7 +108,7 @@ static void test_decompress_startswith(int compression,
r = compress(data, data_len, compressed, &csize);
if (r == -ENOBUFS) {
- log_info_errno(-r, "compression failed: %m");
+ log_info_errno(r, "compression failed: %m");
assert(may_fail);
return;
}