diff options
174 files changed, 1002 insertions, 1002 deletions
diff --git a/src/ac-power/ac-power.c b/src/ac-power/ac-power.c index 8f35bd8bb8..2f25734612 100644 --- a/src/ac-power/ac-power.c +++ b/src/ac-power/ac-power.c @@ -29,7 +29,7 @@ int main(int argc, char *argv[]) { r = on_ac_power(); if (r < 0) { - log_error_errno(-r, "Failed to read AC status: %m"); + log_error_errno(r, "Failed to read AC status: %m"); return EXIT_FAILURE; } diff --git a/src/activate/activate.c b/src/activate/activate.c index f4f41ed36c..70f86bb1e9 100644 --- a/src/activate/activate.c +++ b/src/activate/activate.c @@ -103,7 +103,7 @@ static int open_sockets(int *epoll_fd, bool accept) { fd = make_socket_fd(LOG_DEBUG, *address, SOCK_STREAM | (arg_accept*SOCK_CLOEXEC)); if (fd < 0) { log_open(); - log_error_errno(-fd, "Failed to open '%s': %m", *address); + log_error_errno(fd, "Failed to open '%s': %m", *address); return fd; } diff --git a/src/analyze/analyze-verify.c b/src/analyze/analyze-verify.c index a0f33cbcc2..3458d804b1 100644 --- a/src/analyze/analyze-verify.c +++ b/src/analyze/analyze-verify.c @@ -222,7 +222,7 @@ int verify_units(char **filenames, SystemdRunningAs running_as, bool check_man) /* set the path */ r = generate_path(&var, filenames); if (r < 0) { - log_error_errno(-r, "Failed to generate unit load path: %m"); + log_error_errno(r, "Failed to generate unit load path: %m"); return r; } @@ -230,7 +230,7 @@ int verify_units(char **filenames, SystemdRunningAs running_as, bool check_man) r = manager_new(running_as, true, &m); if (r < 0) { - log_error_errno(-r, "Failed to initalize manager: %m"); + log_error_errno(r, "Failed to initalize manager: %m"); return r; } @@ -238,7 +238,7 @@ int verify_units(char **filenames, SystemdRunningAs running_as, bool check_man) r = manager_startup(m, serial, fdset); if (r < 0) { - log_error_errno(-r, "Failed to start manager: %m"); + log_error_errno(r, "Failed to start manager: %m"); goto finish; } @@ -260,7 +260,7 @@ int verify_units(char **filenames, SystemdRunningAs running_as, bool check_man) } else k = manager_load_unit(m, NULL, *filename, &err, &units[count]); if (k < 0) { - log_error_errno(-k, "Failed to load %s: %m", *filename); + log_error_errno(k, "Failed to load %s: %m", *filename); if (r == 0) r = k; } else diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index cc6cbab65e..9a5fd741c7 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -1362,7 +1362,7 @@ int main(int argc, char *argv[]) { r = bus_open_transport_systemd(arg_transport, arg_host, arg_user, &bus); if (r < 0) { - log_error_errno(-r, "Failed to create bus connection: %m"); + log_error_errno(r, "Failed to create bus connection: %m"); goto finish; } diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c index ab05a7d1a7..2f1b3b2f9c 100644 --- a/src/backlight/backlight.c +++ b/src/backlight/backlight.c @@ -211,7 +211,7 @@ static unsigned get_max_brightness(struct udev_device *device) { r = safe_atou(max_brightness_str, &max_brightness); if (r < 0) { - log_warning_errno(-r, "Failed to parse 'max_brightness' \"%s\": %m", max_brightness_str); + log_warning_errno(r, "Failed to parse 'max_brightness' \"%s\": %m", max_brightness_str); return 0; } @@ -235,7 +235,7 @@ static void clamp_brightness(struct udev_device *device, char **value, unsigned r = safe_atou(*value, &brightness); if (r < 0) { - log_warning_errno(-r, "Failed to parse brightness \"%s\": %m", *value); + log_warning_errno(r, "Failed to parse brightness \"%s\": %m", *value); return; } @@ -387,7 +387,7 @@ int main(int argc, char *argv[]) { if (r == -ENOENT) return EXIT_SUCCESS; - log_error_errno(-r, "Failed to read %s: %m", saved); + log_error_errno(r, "Failed to read %s: %m", saved); return EXIT_FAILURE; } @@ -416,7 +416,7 @@ int main(int argc, char *argv[]) { r = write_string_file(saved, value); if (r < 0) { - log_error_errno(-r, "Failed to write %s: %m", saved); + log_error_errno(r, "Failed to write %s: %m", saved); return EXIT_FAILURE; } diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c index ca650fb009..7fb0664988 100644 --- a/src/binfmt/binfmt.c +++ b/src/binfmt/binfmt.c @@ -65,7 +65,7 @@ static int apply_rule(const char *rule) { r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule); if (r < 0) { - log_error_errno(-r, "Failed to add binary format: %m"); + log_error_errno(r, "Failed to add binary format: %m"); return r; } @@ -83,7 +83,7 @@ static int apply_file(const char *path, bool ignore_enoent) { if (ignore_enoent && r == -ENOENT) return 0; - log_error_errno(-r, "Failed to open file '%s', ignoring: %m", path); + log_error_errno(r, "Failed to open file '%s', ignoring: %m", path); return r; } @@ -191,7 +191,7 @@ int main(int argc, char *argv[]) { r = conf_files_list_nulstr(&files, ".conf", NULL, conf_file_dirs); if (r < 0) { - log_error_errno(-r, "Failed to enumerate binfmt.d files: %m"); + log_error_errno(r, "Failed to enumerate binfmt.d files: %m"); goto finish; } diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c index e0a5542fa9..f025c76fb6 100644 --- a/src/bootchart/bootchart.c +++ b/src/bootchart/bootchart.c @@ -290,7 +290,7 @@ static void do_journal_append(char *file) { } n = loop_read(f, p + 10, BOOTCHART_MAX, false); if (n < 0) { - log_error_errno(-n, "Failed to read bootchart data: %m"); + log_error_errno(n, "Failed to read bootchart data: %m"); close(f); return; } @@ -302,7 +302,7 @@ static void do_journal_append(char *file) { r = sd_journal_sendv(iovec, j); if (r < 0) - log_error_errno(-r, "Failed to send bootchart: %m"); + log_error_errno(r, "Failed to send bootchart: %m"); } int main(int argc, char *argv[]) { diff --git a/src/bus-proxyd/bus-policy.c b/src/bus-proxyd/bus-policy.c index 9a83efe845..15acae2a38 100644 --- a/src/bus-proxyd/bus-policy.c +++ b/src/bus-proxyd/bus-policy.c @@ -95,7 +95,7 @@ static int file_load(Policy *p, const char *path) { if (r == -EISDIR) return r; - log_error_errno(-r, "Failed to load %s: %m", path); + log_error_errno(r, "Failed to load %s: %m", path); return r; } @@ -106,7 +106,7 @@ static int file_load(Policy *p, const char *path) { t = xml_tokenize(&q, &name, &xml_state, &line); if (t < 0) { - log_error_errno(-t, "XML parse failure in %s: %m", path); + log_error_errno(t, "XML parse failure in %s: %m", path); return t; } @@ -358,7 +358,7 @@ static int file_load(Policy *p, const char *path) { r = get_user_creds(&u, &i->uid, NULL, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Failed to resolve user %s, ignoring policy: %m", u); + log_error_errno(r, "Failed to resolve user %s, ignoring policy: %m", u); free(i); } else { PolicyItem *first; @@ -390,7 +390,7 @@ static int file_load(Policy *p, const char *path) { r = get_group_creds(&g, &i->gid); if (r < 0) { - log_error_errno(-r, "Failed to resolve group %s, ignoring policy: %m", g); + log_error_errno(r, "Failed to resolve group %s, ignoring policy: %m", g); free(i); } else { PolicyItem *first; @@ -533,7 +533,7 @@ static int file_load(Policy *p, const char *path) { r = get_user_creds(&u, &i->uid, NULL, NULL, NULL); if (r < 0) - log_error_errno(-r, "Failed to resolve user %s: %m", name); + log_error_errno(r, "Failed to resolve user %s: %m", name); else i->uid_valid = true; } @@ -544,7 +544,7 @@ static int file_load(Policy *p, const char *path) { r = get_group_creds(&g, &i->gid); if (r < 0) - log_error_errno(-r, "Failed to resolve group %s: %m", name); + log_error_errno(r, "Failed to resolve group %s: %m", name); else i->gid_valid = true; } @@ -895,7 +895,7 @@ int policy_load(Policy *p, char **files) { r = conf_files_list(&l, ".conf", NULL, *i, NULL); if (r < 0) { - log_error_errno(-r, "Failed to get configuration file list: %m"); + log_error_errno(r, "Failed to get configuration file list: %m"); return r; } diff --git a/src/bus-proxyd/bus-proxyd.c b/src/bus-proxyd/bus-proxyd.c index 79f2f6e53c..5c8357c7b5 100644 --- a/src/bus-proxyd/bus-proxyd.c +++ b/src/bus-proxyd/bus-proxyd.c @@ -1160,31 +1160,31 @@ static int process_hello(sd_bus *a, sd_bus *b, sd_bus_message *m, bool *got_hell r = sd_bus_message_new_method_return(m, &n); if (r < 0) { - log_error_errno(-r, "Failed to generate HELLO reply: %m"); + log_error_errno(r, "Failed to generate HELLO reply: %m"); return r; } r = sd_bus_message_append(n, "s", a->unique_name); if (r < 0) { - log_error_errno(-r, "Failed to append unique name to HELLO reply: %m"); + log_error_errno(r, "Failed to append unique name to HELLO reply: %m"); return r; } r = bus_message_append_sender(n, "org.freedesktop.DBus"); if (r < 0) { - log_error_errno(-r, "Failed to append sender to HELLO reply: %m"); + log_error_errno(r, "Failed to append sender to HELLO reply: %m"); return r; } r = bus_seal_synthetic_message(b, n); if (r < 0) { - log_error_errno(-r, "Failed to seal HELLO reply: %m"); + log_error_errno(r, "Failed to seal HELLO reply: %m"); return r; } r = sd_bus_send(b, n, NULL); if (r < 0) { - log_error_errno(-r, "Failed to send HELLO reply: %m"); + log_error_errno(r, "Failed to send HELLO reply: %m"); return r; } @@ -1196,31 +1196,31 @@ static int process_hello(sd_bus *a, sd_bus *b, sd_bus_message *m, bool *got_hell "org.freedesktop.DBus", "NameAcquired"); if (r < 0) { - log_error_errno(-r, "Failed to allocate initial NameAcquired message: %m"); + log_error_errno(r, "Failed to allocate initial NameAcquired message: %m"); return r; } r = sd_bus_message_append(n, "s", a->unique_name); if (r < 0) { - log_error_errno(-r, "Failed to append unique name to NameAcquired message: %m"); + log_error_errno(r, "Failed to append unique name to NameAcquired message: %m"); return r; } r = bus_message_append_sender(n, "org.freedesktop.DBus"); if (r < 0) { - log_error_errno(-r, "Failed to append sender to NameAcquired message: %m"); + log_error_errno(r, "Failed to append sender to NameAcquired message: %m"); return r; } r = bus_seal_synthetic_message(b, n); if (r < 0) { - log_error_errno(-r, "Failed to seal NameAcquired message: %m"); + log_error_errno(r, "Failed to seal NameAcquired message: %m"); return r; } r = sd_bus_send(b, n, NULL); if (r < 0) { - log_error_errno(-r, "Failed to send NameAcquired message: %m"); + log_error_errno(r, "Failed to send NameAcquired message: %m"); return r; } @@ -1305,7 +1305,7 @@ int main(int argc, char *argv[]) { r = get_user_creds(&user, &uid, &gid, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Cannot resolve user name %s: %m", user); + log_error_errno(r, "Cannot resolve user name %s: %m", user); goto finish; } @@ -1322,31 +1322,31 @@ int main(int argc, char *argv[]) { r = sd_bus_new(&a); if (r < 0) { - log_error_errno(-r, "Failed to allocate bus: %m"); + log_error_errno(r, "Failed to allocate bus: %m"); goto finish; } r = sd_bus_set_description(a, "sd-proxy"); if (r < 0) { - log_error_errno(-r, "Failed to set bus name: %m"); + log_error_errno(r, "Failed to set bus name: %m"); goto finish; } r = sd_bus_set_address(a, arg_address); if (r < 0) { - log_error_errno(-r, "Failed to set address to connect to: %m"); + log_error_errno(r, "Failed to set address to connect to: %m"); goto finish; } r = sd_bus_negotiate_fds(a, is_unix); if (r < 0) { - log_error_errno(-r, "Failed to set FD negotiation: %m"); + log_error_errno(r, "Failed to set FD negotiation: %m"); goto finish; } r = sd_bus_negotiate_creds(a, true, SD_BUS_CREDS_UID|SD_BUS_CREDS_PID|SD_BUS_CREDS_GID|SD_BUS_CREDS_SELINUX_CONTEXT); if (r < 0) { - log_error_errno(-r, "Failed to set credential negotiation: %m"); + log_error_errno(r, "Failed to set credential negotiation: %m"); goto finish; } @@ -1374,13 +1374,13 @@ int main(int argc, char *argv[]) { r = sd_bus_start(a); if (r < 0) { - log_error_errno(-r, "Failed to start bus client: %m"); + log_error_errno(r, "Failed to start bus client: %m"); goto finish; } r = sd_bus_get_owner_id(a, &server_id); if (r < 0) { - log_error_errno(-r, "Failed to get server ID: %m"); + log_error_errno(r, "Failed to get server ID: %m"); goto finish; } @@ -1390,13 +1390,13 @@ int main(int argc, char *argv[]) { r = sd_bus_get_owner_creds(a, SD_BUS_CREDS_UID, &bus_creds); if (r < 0) { - log_error_errno(-r, "Failed to get bus creds: %m"); + log_error_errno(r, "Failed to get bus creds: %m"); goto finish; } r = sd_bus_creds_get_uid(bus_creds, &bus_uid); if (r < 0) { - log_error_errno(-r, "Failed to get bus owner UID: %m"); + log_error_errno(r, "Failed to get bus owner UID: %m"); goto finish; } @@ -1406,7 +1406,7 @@ int main(int argc, char *argv[]) { r = policy_load(&policy_buffer, arg_configuration); if (r < 0) { - log_error_errno(-r, "Failed to load policy: %m"); + log_error_errno(r, "Failed to load policy: %m"); goto finish; } @@ -1423,37 +1423,37 @@ int main(int argc, char *argv[]) { r = sd_bus_new(&b); if (r < 0) { - log_error_errno(-r, "Failed to allocate bus: %m"); + log_error_errno(r, "Failed to allocate bus: %m"); goto finish; } r = sd_bus_set_fd(b, in_fd, out_fd); if (r < 0) { - log_error_errno(-r, "Failed to set fds: %m"); + log_error_errno(r, "Failed to set fds: %m"); goto finish; } r = sd_bus_set_server(b, 1, server_id); if (r < 0) { - log_error_errno(-r, "Failed to set server mode: %m"); + log_error_errno(r, "Failed to set server mode: %m"); goto finish; } r = sd_bus_negotiate_fds(b, is_unix); if (r < 0) { - log_error_errno(-r, "Failed to set FD negotiation: %m"); + log_error_errno(r, "Failed to set FD negotiation: %m"); goto finish; } r = sd_bus_negotiate_creds(b, true, SD_BUS_CREDS_UID|SD_BUS_CREDS_PID|SD_BUS_CREDS_GID|SD_BUS_CREDS_SELINUX_CONTEXT); if (r < 0) { - log_error_errno(-r, "Failed to set credential negotiation: %m"); + log_error_errno(r, "Failed to set credential negotiation: %m"); goto finish; } r = sd_bus_set_anonymous(b, true); if (r < 0) { - log_error_errno(-r, "Failed to set anonymous authentication: %m"); + log_error_errno(r, "Failed to set anonymous authentication: %m"); goto finish; } @@ -1461,13 +1461,13 @@ int main(int argc, char *argv[]) { r = sd_bus_start(b); if (r < 0) { - log_error_errno(-r, "Failed to start bus client: %m"); + log_error_errno(r, "Failed to start bus client: %m"); goto finish; } r = rename_service(a, b); if (r < 0) - log_debug_errno(-r, "Failed to rename process: %m"); + log_debug_errno(r, "Failed to rename process: %m"); if (a->is_kernel) { _cleanup_free_ char *match = NULL; @@ -1475,7 +1475,7 @@ int main(int argc, char *argv[]) { r = sd_bus_get_unique_name(a, &unique); if (r < 0) { - log_error_errno(-r, "Failed to get unique name: %m"); + log_error_errno(r, "Failed to get unique name: %m"); goto finish; } @@ -1495,7 +1495,7 @@ int main(int argc, char *argv[]) { r = sd_bus_add_match(a, NULL, match, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Failed to add match for NameLost: %m"); + log_error_errno(r, "Failed to add match for NameLost: %m"); goto finish; } @@ -1516,7 +1516,7 @@ int main(int argc, char *argv[]) { r = sd_bus_add_match(a, NULL, match, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Failed to add match for NameAcquired: %m"); + log_error_errno(r, "Failed to add match for NameAcquired: %m"); goto finish; } } @@ -1538,7 +1538,7 @@ int main(int argc, char *argv[]) { if (r == -ECONNRESET) r = 0; else - log_error_errno(-r, "Failed to process bus a: %m"); + log_error_errno(r, "Failed to process bus a: %m"); goto finish; } @@ -1555,7 +1555,7 @@ int main(int argc, char *argv[]) { k = synthesize_name_acquired(a, b, m); if (k < 0) { r = k; - log_error_errno(-r, "Failed to synthesize message: %m"); + log_error_errno(r, "Failed to synthesize message: %m"); goto finish; } @@ -1565,7 +1565,7 @@ int main(int argc, char *argv[]) { k = process_policy(a, b, m, policy, &ucred, owned_names); if (k < 0) { r = k; - log_error_errno(-r, "Failed to process policy: %m"); + log_error_errno(r, "Failed to process policy: %m"); goto finish; } else if (k > 0) { r = 1; @@ -1580,7 +1580,7 @@ int main(int argc, char *argv[]) { r = 0; else { r = k; - log_error_errno(-r, "Failed to send message to client: %m"); + log_error_errno(r, "Failed to send message to client: %m"); } goto finish; @@ -1600,7 +1600,7 @@ int main(int argc, char *argv[]) { if (r == -ECONNRESET) r = 0; else - log_error_errno(-r, "Failed to process bus b: %m"); + log_error_errno(r, "Failed to process bus b: %m"); goto finish; } @@ -1617,7 +1617,7 @@ int main(int argc, char *argv[]) { k = process_hello(a, b, m, &got_hello); if (k < 0) { r = k; - log_error_errno(-r, "Failed to process HELLO: %m"); + log_error_errno(r, "Failed to process HELLO: %m"); goto finish; } else if (k > 0) { processed = true; @@ -1628,7 +1628,7 @@ int main(int argc, char *argv[]) { k = process_driver(a, b, m, policy, &ucred, owned_names); if (k < 0) { r = k; - log_error_errno(-r, "Failed to process driver calls: %m"); + log_error_errno(r, "Failed to process driver calls: %m"); goto finish; } else if (k > 0) { processed = true; @@ -1642,7 +1642,7 @@ int main(int argc, char *argv[]) { k = process_policy(b, a, m, policy, &ucred, owned_names); if (k < 0) { r = k; - log_error_errno(-r, "Failed to process policy: %m"); + log_error_errno(r, "Failed to process policy: %m"); goto finish; } else if (k > 0) { processed = true; @@ -1660,7 +1660,7 @@ int main(int argc, char *argv[]) { r = 0; else { r = k; - log_error_errno(-r, "Failed to send message to bus: %m"); + log_error_errno(r, "Failed to send message to bus: %m"); } goto finish; @@ -1678,31 +1678,31 @@ int main(int argc, char *argv[]) { fd = sd_bus_get_fd(a); if (fd < 0) { - log_error_errno(-r, "Failed to get fd: %m"); + log_error_errno(r, "Failed to get fd: %m"); goto finish; } events_a = sd_bus_get_events(a); if (events_a < 0) { - log_error_errno(-r, "Failed to get events mask: %m"); + log_error_errno(r, "Failed to get events mask: %m"); goto finish; } r = sd_bus_get_timeout(a, &timeout_a); if (r < 0) { - log_error_errno(-r, "Failed to get timeout: %m"); + log_error_errno(r, "Failed to get timeout: %m"); goto finish; } events_b = sd_bus_get_events(b); if (events_b < 0) { - log_error_errno(-r, "Failed to get events mask: %m"); + log_error_errno(r, "Failed to get events mask: %m"); goto finish; } r = sd_bus_get_timeout(b, &timeout_b); if (r < 0) { - log_error_errno(-r, "Failed to get timeout: %m"); + log_error_errno(r, "Failed to get timeout: %m"); goto finish; } diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c index 7fc346d6f5..71921c4a80 100644 --- a/src/cgls/cgls.c +++ b/src/cgls/cgls.c @@ -155,7 +155,7 @@ int main(int argc, char *argv[]) { r = bus_open_transport(BUS_TRANSPORT_LOCAL, NULL, false, &bus); if (r < 0) { - log_error_errno(-r, "Failed to create bus connection: %m"); + log_error_errno(r, "Failed to create bus connection: %m"); goto finish; } @@ -206,7 +206,7 @@ int main(int argc, char *argv[]) { m = strappenda("/run/systemd/machines/", arg_machine); r = parse_env_file(m, NEWLINE, "SCOPE", &scope, NULL); if (r < 0) { - log_error_errno(-r, "Failed to get machine path: %m"); + log_error_errno(r, "Failed to get machine path: %m"); goto finish; } @@ -257,7 +257,7 @@ int main(int argc, char *argv[]) { } if (r < 0) { - log_error_errno(-r, "Failed to list cgroup tree %s: %m", root); + log_error_errno(r, "Failed to list cgroup tree %s: %m", root); retval = EXIT_FAILURE; } else retval = EXIT_SUCCESS; diff --git a/src/cgroups-agent/cgroups-agent.c b/src/cgroups-agent/cgroups-agent.c index 1b215b99ab..529e843030 100644 --- a/src/cgroups-agent/cgroups-agent.c +++ b/src/cgroups-agent/cgroups-agent.c @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) { /* If we couldn't connect we assume this was triggered * while systemd got restarted/transitioned from * initrd to the system, so let's ignore this */ - log_debug_errno(-r, "Failed to get D-Bus connection: %m"); + log_debug_errno(r, "Failed to get D-Bus connection: %m"); return EXIT_FAILURE; } @@ -58,7 +58,7 @@ int main(int argc, char *argv[]) { "Released", "s", argv[1]); if (r < 0) { - log_debug_errno(-r, "Failed to send signal message on private connection: %m"); + log_debug_errno(r, "Failed to send signal message on private connection: %m"); return EXIT_FAILURE; } diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c index 79592aaa17..3c7ad40605 100644 --- a/src/cgtop/cgtop.c +++ b/src/cgtop/cgtop.c @@ -748,7 +748,7 @@ int main(int argc, char *argv[]) { if (r == -ETIMEDOUT) continue; if (r < 0) { - log_error_errno(-r, "Couldn't read key: %m"); + log_error_errno(r, "Couldn't read key: %m"); goto finish; } } @@ -842,7 +842,7 @@ finish: group_hashmap_free(b); if (r < 0) { - log_error_errno(-r, "Exiting with failure: %m"); + log_error_errno(r, "Exiting with failure: %m"); return EXIT_FAILURE; } diff --git a/src/console/consoled-session.c b/src/console/consoled-session.c index abdb1bc481..c81bb306b7 100644 --- a/src/console/consoled-session.c +++ b/src/console/consoled-session.c @@ -231,7 +231,7 @@ void session_dirty(Session *s) { r = sd_event_source_set_enabled(s->redraw_src, SD_EVENT_ONESHOT); if (r < 0) - log_error_errno(-r, "Cannot enable redraw-source: %m"); + log_error_errno(r, "Cannot enable redraw-source: %m"); } void session_add_device(Session *s, sysview_device *device) { diff --git a/src/console/consoled-terminal.c b/src/console/consoled-terminal.c index 7d0f646c7e..166a43b5b1 100644 --- a/src/console/consoled-terminal.c +++ b/src/console/consoled-terminal.c @@ -52,7 +52,7 @@ static int terminal_pty_fn(Pty *pty, void *userdata, unsigned int event, const v case PTY_DATA: r = term_screen_feed_text(t->screen, ptr, size); if (r < 0) - log_error_errno(-r, "Cannot update screen state: %m"); + log_error_errno(r, "Cannot update screen state: %m"); workspace_dirty(t->workspace); break; @@ -128,12 +128,12 @@ void terminal_resize(Terminal *t) { if (t->pty) { r = pty_resize(t->pty, width, height); if (r < 0) - log_error_errno(-r, "Cannot resize pty: %m"); + log_error_errno(r, "Cannot resize pty: %m"); } r = term_screen_resize(t->screen, width, height); if (r < 0) - log_error_errno(-r, "Cannot resize screen: %m"); + log_error_errno(r, "Cannot resize screen: %m"); } void terminal_run(Terminal *t) { @@ -151,7 +151,7 @@ void terminal_run(Terminal *t) { term_screen_get_width(t->screen), term_screen_get_height(t->screen)); if (pid < 0) { - log_error_errno(-pid, "Cannot fork PTY: %m"); + log_error_errno(pid, "Cannot fork PTY: %m"); return; } else if (pid == 0) { /* child */ diff --git a/src/console/consoled.c b/src/console/consoled.c index f76a357c97..6f65dcdcb9 100644 --- a/src/console/consoled.c +++ b/src/console/consoled.c @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) { r = manager_new(&m); if (r < 0) { - log_error_errno(-r, "Could not create manager: %m"); + log_error_errno(r, "Could not create manager: %m"); goto out; } @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) { r = manager_run(m); if (r < 0) { - log_error_errno(-r, "Cannot run manager: %m"); + log_error_errno(r, "Cannot run manager: %m"); goto out; } diff --git a/src/core/busname.c b/src/core/busname.c index eaf5b3c2ba..8e9d1cfb7f 100644 --- a/src/core/busname.c +++ b/src/core/busname.c @@ -409,7 +409,7 @@ static int busname_make_starter(BusName *n, pid_t *_pid) { fail_child: log_open(); - log_error_errno(-r, "Failed to create starter connection at step %s: %m", exit_status_to_string(ret, EXIT_STATUS_SYSTEMD)); + log_error_errno(r, "Failed to create starter connection at step %s: %m", exit_status_to_string(ret, EXIT_STATUS_SYSTEMD)); _exit(ret); } diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 784a945dd6..02c4e0a419 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -631,7 +631,7 @@ static int unit_create_cgroups(Unit *u, CGroupControllerMask mask) { /* First, create our own group */ r = cg_create_everywhere(u->manager->cgroup_supported, mask, u->cgroup_path); if (r < 0) { - log_error_errno(-r, "Failed to create cgroup %s: %m", u->cgroup_path); + log_error_errno(r, "Failed to create cgroup %s: %m", u->cgroup_path); return r; } @@ -642,7 +642,7 @@ static int unit_create_cgroups(Unit *u, CGroupControllerMask mask) { /* Then, possibly move things over */ r = cg_migrate_everywhere(u->manager->cgroup_supported, u->cgroup_path, u->cgroup_path, migrate_callback, u); if (r < 0) - log_warning_errno(-r, "Failed to migrate cgroup from to %s: %m", u->cgroup_path); + log_warning_errno(r, "Failed to migrate cgroup from to %s: %m", u->cgroup_path); return 0; } @@ -715,7 +715,7 @@ unsigned manager_dispatch_cgroup_queue(Manager *m) { r = unit_realize_cgroup_now(i, state); if (r < 0) - log_warning_errno(-r, "Failed to realize cgroups for queued unit %s: %m", i->id); + log_warning_errno(r, "Failed to realize cgroups for queued unit %s: %m", i->id); n++; } @@ -798,7 +798,7 @@ void unit_destroy_cgroup(Unit *u) { r = cg_trim_everywhere(u->manager->cgroup_supported, u->cgroup_path, !unit_has_name(u, SPECIAL_ROOT_SLICE)); if (r < 0) - log_debug_errno(-r, "Failed to destroy cgroup %s: %m", u->cgroup_path); + log_debug_errno(r, "Failed to destroy cgroup %s: %m", u->cgroup_path); hashmap_remove(u->manager->cgroup_unit, u->cgroup_path); @@ -858,7 +858,7 @@ int manager_setup_cgroup(Manager *m) { r = cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER, 0, &m->cgroup_root); if (r < 0) { - log_error_errno(-r, "Cannot determine cgroup we are running in: %m"); + log_error_errno(r, "Cannot determine cgroup we are running in: %m"); return r; } @@ -884,7 +884,7 @@ int manager_setup_cgroup(Manager *m) { /* 2. Show data */ r = cg_get_path(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_root, NULL, &path); if (r < 0) { - log_error_errno(-r, "Cannot find cgroup mount point: %m"); + log_error_errno(r, "Cannot find cgroup mount point: %m"); return r; } @@ -895,7 +895,7 @@ int manager_setup_cgroup(Manager *m) { if (m->running_as == SYSTEMD_SYSTEM) { r = cg_install_release_agent(SYSTEMD_CGROUP_CONTROLLER, SYSTEMD_CGROUP_AGENT_PATH); if (r < 0) - log_warning_errno(-r, "Failed to install release agent, ignoring: %m"); + log_warning_errno(r, "Failed to install release agent, ignoring: %m"); else if (r > 0) log_debug("Installed release agent."); else @@ -905,7 +905,7 @@ int manager_setup_cgroup(Manager *m) { /* 4. Make sure we are in the root cgroup */ r = cg_create_and_attach(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_root, 0); if (r < 0) { - log_error_errno(-r, "Failed to create root cgroup hierarchy: %m"); + log_error_errno(r, "Failed to create root cgroup hierarchy: %m"); return r; } diff --git a/src/core/dbus-job.c b/src/core/dbus-job.c index 36d6dee75f..8b5ea2566d 100644 --- a/src/core/dbus-job.c +++ b/src/core/dbus-job.c @@ -154,7 +154,7 @@ void bus_job_send_change_signal(Job *j) { r = bus_foreach_bus(j->manager, j->clients, j->sent_dbus_new_signal ? send_changed_signal : send_new_signal, j); if (r < 0) - log_debug_errno(-r, "Failed to send job change signal for %u: %m", j->id); + log_debug_errno(r, "Failed to send job change signal for %u: %m", j->id); j->sent_dbus_new_signal = true; } @@ -198,5 +198,5 @@ void bus_job_send_removed_signal(Job *j) { r = bus_foreach_bus(j->manager, j->clients, send_removed_signal, j); if (r < 0) - log_debug_errno(-r, "Failed to send job remove signal for %u: %m", j->id); + log_debug_errno(r, "Failed to send job remove signal for %u: %m", j->id); } diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 765d376820..0994d7b5c3 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -1514,7 +1514,7 @@ static int reply_unit_file_changes_and_free( if (n_changes > 0) { r = bus_foreach_bus(m, NULL, send_unit_files_changed, NULL); if (r < 0) - log_debug_errno(-r, "Failed to send UnitFilesChanged signal: %m"); + log_debug_errno(r, "Failed to send UnitFilesChanged signal: %m"); } r = sd_bus_message_new_method_return(message, &reply); @@ -1998,7 +1998,7 @@ void bus_manager_send_finished( total_usec }); if (r < 0) - log_debug_errno(-r, "Failed to send finished signal: %m"); + log_debug_errno(r, "Failed to send finished signal: %m"); } static int send_reloading(sd_bus *bus, void *userdata) { @@ -2025,6 +2025,6 @@ void bus_manager_send_reloading(Manager *m, bool active) { r = bus_foreach_bus(m, NULL, send_reloading, INT_TO_PTR(active)); if (r < 0) - log_debug_errno(-r, "Failed to send reloading signal: %m"); + log_debug_errno(r, "Failed to send reloading signal: %m"); } diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 9635fcd543..36b68aee9e 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -693,7 +693,7 @@ void bus_unit_send_change_signal(Unit *u) { r = bus_foreach_bus(u->manager, NULL, u->sent_dbus_new_signal ? send_changed_signal : send_new_signal, u); if (r < 0) - log_debug_errno(-r, "Failed to send unit change signal for %s: %m", u->id); + log_debug_errno(r, "Failed to send unit change signal for %s: %m", u->id); u->sent_dbus_new_signal = true; } @@ -739,7 +739,7 @@ void bus_unit_send_removed_signal(Unit *u) { r = bus_foreach_bus(u->manager, NULL, send_removed_signal, u); if (r < 0) - log_debug_errno(-r, "Failed to send unit remove signal for %s: %m", u->id); + log_debug_errno(r, "Failed to send unit remove signal for %s: %m", u->id); } int bus_unit_queue_job( diff --git a/src/core/dbus.c b/src/core/dbus.c index b02cf34e5d..b843fe09f3 100644 --- a/src/core/dbus.c +++ b/src/core/dbus.c @@ -64,7 +64,7 @@ int bus_send_queued_message(Manager *m) { r = sd_bus_send(m->queued_message_bus, m->queued_message, NULL); if (r < 0) - log_warning_errno(-r, "Failed to send queued message: %m"); + log_warning_errno(r, "Failed to send queued message: %m"); m->queued_message = sd_bus_message_unref(m->queued_message); m->queued_message_bus = sd_bus_unref(m->queued_message_bus); @@ -95,7 +95,7 @@ static int signal_agent_released(sd_bus *bus, sd_bus_message *message, void *use r = sd_bus_send(m->system_bus, message, NULL); if (r < 0) - log_warning_errno(-r, "Failed to forward Released message: %m"); + log_warning_errno(r, "Failed to forward Released message: %m"); } return 0; @@ -203,7 +203,7 @@ failed: r = sd_bus_send_to(bus, reply, "org.freedesktop.DBus", NULL); if (r < 0) { - log_error_errno(-r, "Failed to respond with to bus activation request: %m"); + log_error_errno(r, "Failed to respond with to bus activation request: %m"); return r; } @@ -538,58 +538,58 @@ static int bus_setup_api_vtables(Manager *m, sd_bus *bus) { #ifdef HAVE_SELINUX r = sd_bus_add_filter(bus, NULL, mac_selinux_filter, m); if (r < 0) { - log_error_errno(-r, "Failed to add SELinux access filter: %m"); + log_error_errno(r, "Failed to add SELinux access filter: %m"); return r; } #endif r = sd_bus_add_object_vtable(bus, NULL, "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", bus_manager_vtable, m); if (r < 0) { - log_error_errno(-r, "Failed to register Manager vtable: %m"); + log_error_errno(r, "Failed to register Manager vtable: %m"); return r; } r = sd_bus_add_fallback_vtable(bus, NULL, "/org/freedesktop/systemd1/job", "org.freedesktop.systemd1.Job", bus_job_vtable, bus_job_find, m); if (r < 0) { - log_error_errno(-r, "Failed to register Job vtable: %m"); + log_error_errno(r, "Failed to register Job vtable: %m"); return r; } r = sd_bus_add_node_enumerator(bus, NULL, "/org/freedesktop/systemd1/job", bus_job_enumerate, m); if (r < 0) { - log_error_errno(-r, "Failed to add job enumerator: %m"); + log_error_errno(r, "Failed to add job enumerator: %m"); return r; } r = sd_bus_add_fallback_vtable(bus, NULL, "/org/freedesktop/systemd1/unit", "org.freedesktop.systemd1.Unit", bus_unit_vtable, bus_unit_find, m); if (r < 0) { - log_error_errno(-r, "Failed to register Unit vtable: %m"); + log_error_errno(r, "Failed to register Unit vtable: %m"); return r; } r = sd_bus_add_node_enumerator(bus, NULL, "/org/freedesktop/systemd1/unit", bus_unit_enumerate, m); if (r < 0) { - log_error_errno(-r, "Failed to add job enumerator: %m"); + log_error_errno(r, "Failed to add job enumerator: %m"); return r; } for (t = 0; t < _UNIT_TYPE_MAX; t++) { r = sd_bus_add_fallback_vtable(bus, NULL, "/org/freedesktop/systemd1/unit", unit_vtable[t]->bus_interface, unit_vtable[t]->bus_vtable, bus_unit_interface_find, m); if (r < 0) { - log_error_errno(-r, "Failed to register type specific vtable for %s: %m", unit_vtable[t]->bus_interface); + log_error_errno(r, "Failed to register type specific vtable for %s: %m", unit_vtable[t]->bus_interface); return r; } if (unit_vtable[t]->cgroup_context_offset > 0) { r = sd_bus_add_fallback_vtable(bus, NULL, "/org/freedesktop/systemd1/unit", unit_vtable[t]->bus_interface, bus_unit_cgroup_vtable, bus_unit_cgroup_find, m); if (r < 0) { - log_error_errno(-r, "Failed to register control group unit vtable for %s: %m", unit_vtable[t]->bus_interface); + log_error_errno(r, "Failed to register control group unit vtable for %s: %m", unit_vtable[t]->bus_interface); return r; } r = sd_bus_add_fallback_vtable(bus, NULL, "/org/freedesktop/systemd1/unit", unit_vtable[t]->bus_interface, bus_cgroup_vtable, bus_cgroup_context_find, m); if (r < 0) { - log_error_errno(-r, "Failed to register control group vtable for %s: %m", unit_vtable[t]->bus_interface); + log_error_errno(r, "Failed to register control group vtable for %s: %m", unit_vtable[t]->bus_interface); return r; } } @@ -597,7 +597,7 @@ static int bus_setup_api_vtables(Manager *m, sd_bus *bus) { if (unit_vtable[t]->exec_context_offset > 0) { r = sd_bus_add_fallback_vtable(bus, NULL, "/org/freedesktop/systemd1/unit", unit_vtable[t]->bus_interface, bus_exec_vtable, bus_exec_context_find, m); if (r < 0) { - log_error_errno(-r, "Failed to register execute vtable for %s: %m", unit_vtable[t]->bus_interface); + log_error_errno(r, "Failed to register execute vtable for %s: %m", unit_vtable[t]->bus_interface); return r; } } @@ -605,7 +605,7 @@ static int bus_setup_api_vtables(Manager *m, sd_bus *bus) { if (unit_vtable[t]->kill_context_offset > 0) { r = sd_bus_add_fallback_vtable(bus, NULL, "/org/freedesktop/systemd1/unit", unit_vtable[t]->bus_interface, bus_kill_vtable, bus_kill_context_find, m); if (r < 0) { - log_error_errno(-r, "Failed to register kill vtable for %s: %m", unit_vtable[t]->bus_interface); + log_error_errno(r, "Failed to register kill vtable for %s: %m", unit_vtable[t]->bus_interface); return r; } } @@ -631,7 +631,7 @@ static int bus_setup_disconnected_match(Manager *m, sd_bus *bus) { signal_disconnected, m); if (r < 0) { - log_error_errno(-r, "Failed to register match for Disconnected message: %m"); + log_error_errno(r, "Failed to register match for Disconnected message: %m"); return r; } @@ -667,13 +667,13 @@ static int bus_on_connection(sd_event_source *s, int fd, uint32_t revents, void r = sd_bus_new(&bus); if (r < 0) { - log_warning_errno(-r, "Failed to allocate new private connection bus: %m"); + log_warning_errno(r, "Failed to allocate new private connection bus: %m"); return 0; } r = sd_bus_set_fd(bus, nfd, nfd); if (r < 0) { - log_warning_errno(-r, "Failed to set fd on new connection bus: %m"); + log_warning_errno(r, "Failed to set fd on new connection bus: %m"); return 0; } @@ -681,7 +681,7 @@ static int bus_on_connection(sd_event_source *s, int fd, uint32_t revents, void r = bus_check_peercred(bus); if (r < 0) { - log_warning_errno(-r, "Incoming private connection from unprivileged client, refusing: %m"); + log_warning_errno(r, "Incoming private connection from unprivileged client, refusing: %m"); return 0; } @@ -689,19 +689,19 @@ static int bus_on_connection(sd_event_source *s, int fd, uint32_t revents, void r = sd_bus_set_server(bus, 1, id); if (r < 0) { - log_warning_errno(-r, "Failed to enable server support for new connection bus: %m"); + log_warning_errno(r, "Failed to enable server support for new connection bus: %m"); return 0; } r = sd_bus_start(bus); if (r < 0) { - log_warning_errno(-r, "Failed to start new connection bus: %m"); + log_warning_errno(r, "Failed to start new connection bus: %m"); return 0; } r = sd_bus_attach_event(bus, m->event, SD_EVENT_PRIORITY_NORMAL); if (r < 0) { - log_warning_errno(-r, "Failed to attach new connection bus to event loop: %m"); + log_warning_errno(r, "Failed to attach new connection bus to event loop: %m"); return 0; } @@ -719,7 +719,7 @@ static int bus_on_connection(sd_event_source *s, int fd, uint32_t revents, void signal_agent_released, m); if (r < 0) { - log_warning_errno(-r, "Failed to register Released match on new connection bus: %m"); + log_warning_errno(r, "Failed to register Released match on new connection bus: %m"); return 0; } } @@ -730,13 +730,13 @@ static int bus_on_connection(sd_event_source *s, int fd, uint32_t revents, void r = bus_setup_api_vtables(m, bus); if (r < 0) { - log_warning_errno(-r, "Failed to set up API vtables on new connection bus: %m"); + log_warning_errno(r, "Failed to set up API vtables on new connection bus: %m"); return 0; } r = set_put(m->private_buses, bus); if (r < 0) { - log_warning_errno(-r, "Failed to add new conenction bus to set: %m"); + log_warning_errno(r, "Failed to add new conenction bus to set: %m"); return 0; } @@ -757,7 +757,7 @@ static int bus_list_names(Manager *m, sd_bus *bus) { r = sd_bus_list_names(bus, &names, NULL); if (r < 0) { - log_error_errno(-r, "Failed to get initial list of names: %m"); + log_error_errno(r, "Failed to get initial list of names: %m"); return r; } @@ -782,7 +782,7 @@ static int bus_setup_api(Manager *m, sd_bus *bus) { SD_BUS_CREDS_EUID|SD_BUS_CREDS_EFFECTIVE_CAPS| SD_BUS_CREDS_SELINUX_CONTEXT); if (r < 0) - log_warning_errno(-r, "Failed to enable credential passing, ignoring: %m"); + log_warning_errno(r, "Failed to enable credential passing, ignoring: %m"); r = bus_setup_api_vtables(m, bus); if (r < 0) @@ -798,7 +798,7 @@ static int bus_setup_api(Manager *m, sd_bus *bus) { "member='NameOwnerChanged'", signal_name_owner_changed, m); if (r < 0) - log_warning_errno(-r, "Failed to subscribe to NameOwnerChanged signal: %m"); + log_warning_errno(r, "Failed to subscribe to NameOwnerChanged signal: %m"); r = sd_bus_add_match( bus, @@ -810,7 +810,7 @@ static int bus_setup_api(Manager *m, sd_bus *bus) { "member='ActivationRequest'", signal_activation_request, m); if (r < 0) - log_warning_errno(-r, "Failed to subscribe to activation signal: %m"); + log_warning_errno(r, "Failed to subscribe to activation signal: %m"); /* Allow replacing of our name, to ease implementation of * reexecution, where we keep the old connection open until @@ -819,7 +819,7 @@ static int bus_setup_api(Manager *m, sd_bus *bus) { * finish */ r = sd_bus_request_name(bus,"org.freedesktop.systemd1", SD_BUS_NAME_REPLACE_EXISTING|SD_BUS_NAME_ALLOW_REPLACEMENT); if (r < 0) { - log_error_errno(-r, "Failed to register name: %m"); + log_error_errno(r, "Failed to register name: %m"); return r; } @@ -852,7 +852,7 @@ static int bus_init_api(Manager *m) { r = sd_bus_attach_event(bus, m->event, SD_EVENT_PRIORITY_NORMAL); if (r < 0) { - log_error_errno(-r, "Failed to attach API bus to event loop: %m"); + log_error_errno(r, "Failed to attach API bus to event loop: %m"); return 0; } @@ -863,7 +863,7 @@ static int bus_init_api(Manager *m) { r = bus_setup_api(m, bus); if (r < 0) { - log_error_errno(-r, "Failed to set up API bus: %m"); + log_error_errno(r, "Failed to set up API bus: %m"); return 0; } @@ -894,7 +894,7 @@ static int bus_setup_system(Manager *m, sd_bus *bus) { signal_agent_released, m); if (r < 0) - log_warning_errno(-r, "Failed to register Released match on system bus: %m"); + log_warning_errno(r, "Failed to register Released match on system bus: %m"); log_debug("Successfully connected to system bus."); return 0; @@ -925,13 +925,13 @@ static int bus_init_system(Manager *m) { r = sd_bus_attach_event(bus, m->event, SD_EVENT_PRIORITY_NORMAL); if (r < 0) { - log_error_errno(-r, "Failed to attach system bus to event loop: %m"); + log_error_errno(r, "Failed to attach system bus to event loop: %m"); return 0; } r = bus_setup_system(m, bus); if (r < 0) { - log_error_errno(-r, "Failed to set up system bus: %m"); + log_error_errno(r, "Failed to set up system bus: %m"); return 0; } @@ -1007,7 +1007,7 @@ static int bus_init_private(Manager *m) { r = sd_event_add_io(m->event, &s, fd, EPOLLIN, bus_on_connection, m); if (r < 0) { - log_error_errno(-r, "Failed to allocate event source: %m"); + log_error_errno(r, "Failed to allocate event source: %m"); return r; } diff --git a/src/core/device.c b/src/core/device.c index 42e3a261e2..61dbebd37b 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -334,7 +334,7 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p return 0; fail: - log_warning_errno(-r, "Failed to load device unit: %m"); + log_warning_errno(r, "Failed to load device unit: %m"); if (delete && u) unit_free(u); @@ -650,20 +650,20 @@ static int device_dispatch_io(sd_event_source *source, int fd, uint32_t revents, if (streq(action, "remove") || !device_is_ready(dev)) { r = device_process_removed_device(m, dev); if (r < 0) - log_error_errno(-r, "Failed to process device remove event: %m"); + log_error_errno(r, "Failed to process device remove event: %m"); r = swap_process_removed_device(m, dev); if (r < 0) - log_error_errno(-r, "Failed to process swap device remove event: %m"); + log_error_errno(r, "Failed to process swap device remove event: %m"); } else { r = device_process_new_device(m, dev); if (r < 0) - log_error_errno(-r, "Failed to process device new event: %m"); + log_error_errno(r, "Failed to process device new event: %m"); r = swap_process_new_device(m, dev); if (r < 0) - log_error_errno(-r, "Failed to process swap device new event: %m"); + log_error_errno(r, "Failed to process swap device new event: %m"); manager_dispatch_load_queue(m); diff --git a/src/core/execute.c b/src/core/execute.c index d10f362c2e..0f5152fb81 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -823,7 +823,7 @@ static int setup_pam( * If this fails, ignore the error - but expect sd-pam threads * to fail to exit normally */ if (setresuid(uid, uid, uid) < 0) - log_error_errno(-r, "Error: Failed to setresuid() in sd-pam: %m"); + log_error_errno(r, "Error: Failed to setresuid() in sd-pam: %m"); /* Wait until our parent died. This will only work if * the above setresuid() succeeds, otherwise the kernel @@ -2819,7 +2819,7 @@ void exec_runtime_destroy(ExecRuntime *rt) { r = asynchronous_job(remove_tmpdir_thread, rt->tmp_dir); if (r < 0) { - log_warning_errno(-r, "Failed to nuke %s: %m", rt->tmp_dir); + log_warning_errno(r, "Failed to nuke %s: %m", rt->tmp_dir); free(rt->tmp_dir); } @@ -2831,7 +2831,7 @@ void exec_runtime_destroy(ExecRuntime *rt) { r = asynchronous_job(remove_tmpdir_thread, rt->var_tmp_dir); if (r < 0) { - log_warning_errno(-r, "Failed to nuke %s: %m", rt->var_tmp_dir); + log_warning_errno(r, "Failed to nuke %s: %m", rt->var_tmp_dir); free(rt->var_tmp_dir); } diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c index 74ff64883f..f81103a810 100644 --- a/src/core/hostname-setup.c +++ b/src/core/hostname-setup.c @@ -64,7 +64,7 @@ int hostname_setup(void) { if (r == -ENOENT) enoent = true; else - log_warning_errno(-r, "Failed to read configured hostname: %m"); + log_warning_errno(r, "Failed to read configured hostname: %m"); hn = NULL; } else diff --git a/src/core/job.c b/src/core/job.c index ff4982ef0b..78bc1083de 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -1097,7 +1097,7 @@ int job_coldplug(Job *j) { j->begin_usec + j->unit->job_timeout, 0, job_dispatch_timer, j); if (r < 0) - log_debug_errno(-r, "Failed to restart timeout for job: %m"); + log_debug_errno(r, "Failed to restart timeout for job: %m"); return r; } diff --git a/src/core/load-dropin.c b/src/core/load-dropin.c index fcc5881090..0abac9584d 100644 --- a/src/core/load-dropin.c +++ b/src/core/load-dropin.c @@ -87,7 +87,7 @@ static int iterate_dir( r = unit_add_dependency_by_name(u, dependency, de->d_name, f, true); if (r < 0) - log_error_errno(-r, "Cannot add dependency %s to %s, ignoring: %m", de->d_name, u->id); + log_error_errno(r, "Cannot add dependency %s to %s, ignoring: %m", de->d_name, u->id); } return 0; @@ -155,7 +155,7 @@ char **unit_find_dropin_paths(Unit *u) { r = conf_files_list_strv(&configs, ".conf", NULL, (const char**) strv); if (r < 0) { - log_error_errno(-r, "Failed to get list of configuration files: %m"); + log_error_errno(r, "Failed to get list of configuration files: %m"); strv_free(configs); return NULL; } diff --git a/src/core/locale-setup.c b/src/core/locale-setup.c index 4264ec8751..e993c57321 100644 --- a/src/core/locale-setup.c +++ b/src/core/locale-setup.c @@ -56,7 +56,7 @@ int locale_setup(char ***environment) { NULL); if (r < 0 && r != -ENOENT) - log_warning_errno(-r, "Failed to read /proc/cmdline: %m"); + log_warning_errno(r, "Failed to read /proc/cmdline: %m"); } /* Hmm, nothing set on the kernel cmd line? Then let's @@ -80,7 +80,7 @@ int locale_setup(char ***environment) { NULL); if (r < 0 && r != -ENOENT) - log_warning_errno(-r, "Failed to read /etc/locale.conf: %m"); + log_warning_errno(r, "Failed to read /etc/locale.conf: %m"); } add = NULL; diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c index 8fedf69802..9ec93c2559 100644 --- a/src/core/machine-id-setup.c +++ b/src/core/machine-id-setup.c @@ -142,7 +142,7 @@ static int generate(char id[34], const char *root) { /* If that didn't work, generate a random machine id */ r = sd_id128_randomize(&buf); if (r < 0) { - log_error_errno(-r, "Failed to open /dev/urandom: %m"); + log_error_errno(r, "Failed to open /dev/urandom: %m"); return r; } @@ -242,7 +242,7 @@ int machine_id_setup(const char *root) { r = write_string_file(run_machine_id, id); } if (r < 0) { - log_error_errno(-r, "Cannot write %s: %m", run_machine_id); + log_error_errno(r, "Cannot write %s: %m", run_machine_id); unlink(run_machine_id); return r; } diff --git a/src/core/main.c b/src/core/main.c index b5230c948b..30de748452 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -175,7 +175,7 @@ noreturn static void crash(int sig) { /* Order things nicely. */ r = wait_for_terminate(pid, &status); if (r < 0) - log_emergency_errno(-r, "Caught <%s>, waitpid() failed: %m", signal_to_string(sig)); + log_emergency_errno(r, "Caught <%s>, waitpid() failed: %m", signal_to_string(sig)); else if (status.si_code != CLD_DUMPED) log_emergency("Caught <%s>, core dump failed.", signal_to_string(sig)); else @@ -232,7 +232,7 @@ static int console_setup(void) { tty_fd = open_terminal("/dev/console", O_WRONLY|O_NOCTTY|O_CLOEXEC); if (tty_fd < 0) { - log_error_errno(-tty_fd, "Failed to open /dev/console: %m"); + log_error_errno(tty_fd, "Failed to open /dev/console: %m"); return tty_fd; } @@ -240,7 +240,7 @@ static int console_setup(void) { * pictures already from initrd. */ r = reset_terminal_fd(tty_fd, false); if (r < 0) { - log_error_errno(-r, "Failed to reset /dev/console: %m"); + log_error_errno(r, "Failed to reset /dev/console: %m"); return r; } @@ -807,7 +807,7 @@ static int parse_argv(int argc, char *argv[]) { r = set_default_unit(optarg); if (r < 0) { - log_error_errno(-r, "Failed to set default unit %s: %m", optarg); + log_error_errno(r, "Failed to set default unit %s: %m", optarg); return r; } @@ -990,7 +990,7 @@ static int prepare_reexecute(Manager *m, FILE **_f, FDSet **_fds, bool switching r = manager_open_serialization(m, &f); if (r < 0) { - log_error_errno(-r, "Failed to create serialization file: %m"); + log_error_errno(r, "Failed to create serialization file: %m"); goto fail; } @@ -1001,13 +1001,13 @@ static int prepare_reexecute(Manager *m, FILE **_f, FDSet **_fds, bool switching fds = fdset_new(); if (!fds) { r = -ENOMEM; - log_error_errno(-r, "Failed to allocate fd set: %m"); + log_error_errno(r, "Failed to allocate fd set: %m"); goto fail; } r = manager_serialize(m, f, fds, switching_root); if (r < 0) { - log_error_errno(-r, "Failed to serialize state: %m"); + log_error_errno(r, "Failed to serialize state: %m"); goto fail; } @@ -1018,13 +1018,13 @@ static int prepare_reexecute(Manager *m, FILE **_f, FDSet **_fds, bool switching r = fd_cloexec(fileno(f), false); if (r < 0) { - log_error_errno(-r, "Failed to disable O_CLOEXEC for serialization: %m"); + log_error_errno(r, "Failed to disable O_CLOEXEC for serialization: %m"); goto fail; } r = fdset_cloexec(fds, false); if (r < 0) { - log_error_errno(-r, "Failed to disable O_CLOEXEC for serialization fds: %m"); + log_error_errno(r, "Failed to disable O_CLOEXEC for serialization fds: %m"); goto fail; } @@ -1071,7 +1071,7 @@ static int bump_rlimit_nofile(struct rlimit *saved_rlimit) { nl.rlim_cur = nl.rlim_max = 64*1024; r = setrlimit_closest(RLIMIT_NOFILE, &nl); if (r < 0) { - log_error_errno(-r, "Setting RLIMIT_NOFILE failed: %m"); + log_error_errno(r, "Setting RLIMIT_NOFILE failed: %m"); return r; } @@ -1154,20 +1154,20 @@ static int enforce_syscall_archs(Set *archs) { if (r == -EEXIST) continue; if (r < 0) { - log_error_errno(-r, "Failed to add architecture to seccomp: %m"); + log_error_errno(r, "Failed to add architecture to seccomp: %m"); goto finish; } } r = seccomp_attr_set(seccomp, SCMP_FLTATR_CTL_NNP, 0); if (r < 0) { - log_error_errno(-r, "Failed to unset NO_NEW_PRIVS: %m"); + log_error_errno(r, "Failed to unset NO_NEW_PRIVS: %m"); goto finish; } r = seccomp_load(seccomp); if (r < 0) - log_error_errno(-r, "Failed to add install architecture seccomp: %m"); + log_error_errno(r, "Failed to add install architecture seccomp: %m"); finish: seccomp_release(seccomp); @@ -1193,7 +1193,7 @@ static int status_welcome(void) { } if (r < 0 && r != -ENOENT) - log_warning_errno(-r, "Failed to read os-release file: %m"); + log_warning_errno(r, "Failed to read os-release file: %m"); return status_printf(NULL, false, false, "\nWelcome to \x1B[%sm%s\x1B[0m!\n", @@ -1324,7 +1324,7 @@ int main(int argc, char *argv[]) { */ r = clock_set_timezone(&min); if (r < 0) - log_error_errno(-r, "Failed to apply local time delta, ignoring: %m"); + log_error_errno(r, "Failed to apply local time delta, ignoring: %m"); else log_info("RTC configured in localtime, applying delta of %i minutes to system time.", min); } else if (!in_initrd()) { @@ -1383,7 +1383,7 @@ int main(int argc, char *argv[]) { /* Initialize default unit */ r = set_default_unit(SPECIAL_DEFAULT_TARGET); if (r < 0) { - log_emergency_errno(-r, "Failed to set default unit %s: %m", SPECIAL_DEFAULT_TARGET); + log_emergency_errno(r, "Failed to set default unit %s: %m", SPECIAL_DEFAULT_TARGET); error_message = "Failed to set default unit"; goto finish; } @@ -1422,7 +1422,7 @@ int main(int argc, char *argv[]) { if (arg_running_as == SYSTEMD_SYSTEM) { r = parse_proc_cmdline(parse_proc_cmdline_item); if (r < 0) - log_warning_errno(-r, "Failed to parse kernel command line, ignoring: %m"); + log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m"); } /* Note that this also parses bits from the kernel command @@ -1488,7 +1488,7 @@ int main(int argc, char *argv[]) { /* Remember open file descriptors for later deserialization */ r = fdset_new_fill(&fds); if (r < 0) { - log_emergency_errno(-r, "Failed to allocate fd set: %m"); + log_emergency_errno(r, "Failed to allocate fd set: %m"); error_message = "Failed to allocate fd set"; goto finish; } else @@ -1591,13 +1591,13 @@ int main(int argc, char *argv[]) { if (arg_capability_bounding_set_drop) { r = capability_bounding_set_drop_usermode(arg_capability_bounding_set_drop); if (r < 0) { - log_emergency_errno(-r, "Failed to drop capability bounding set of usermode helpers: %m"); + log_emergency_errno(r, "Failed to drop capability bounding set of usermode helpers: %m"); error_message = "Failed to drop capability bounding set of usermode helpers"; goto finish; } r = capability_bounding_set_drop(arg_capability_bounding_set_drop, true); if (r < 0) { - log_emergency_errno(-r, "Failed to drop capability bounding set: %m"); + log_emergency_errno(r, "Failed to drop capability bounding set: %m"); error_message = "Failed to drop capability bounding set"; goto finish; } @@ -1626,7 +1626,7 @@ int main(int argc, char *argv[]) { if (empty_etc) { r = unit_file_preset_all(UNIT_FILE_SYSTEM, false, NULL, UNIT_FILE_PRESET_FULL, false, NULL, 0); if (r < 0) - log_warning_errno(-r, "Failed to populate /etc with preset unit settings, ignoring: %m"); + log_warning_errno(r, "Failed to populate /etc with preset unit settings, ignoring: %m"); else log_info("Populated /etc with preset unit settings."); } @@ -1634,7 +1634,7 @@ int main(int argc, char *argv[]) { r = manager_new(arg_running_as, arg_action == ACTION_TEST, &m); if (r < 0) { - log_emergency_errno(-r, "Failed to allocate manager object: %m"); + log_emergency_errno(r, "Failed to allocate manager object: %m"); error_message = "Failed to allocate manager object"; goto finish; } @@ -1672,7 +1672,7 @@ int main(int argc, char *argv[]) { r = manager_startup(m, arg_serialization, fds); if (r < 0) - log_error_errno(-r, "Failed to fully start up daemon: %m"); + log_error_errno(r, "Failed to fully start up daemon: %m"); /* This will close all file descriptors that were opened, but * not claimed by any unit. */ @@ -1759,7 +1759,7 @@ int main(int argc, char *argv[]) { for (;;) { r = manager_loop(m); if (r < 0) { - log_emergency_errno(-r, "Failed to run main loop: %m"); + log_emergency_errno(r, "Failed to run main loop: %m"); error_message = "Failed to run main loop"; goto finish; } @@ -1775,7 +1775,7 @@ int main(int argc, char *argv[]) { log_info("Reloading."); r = manager_reload(m); if (r < 0) - log_error_errno(-r, "Failed to reload: %m"); + log_error_errno(r, "Failed to reload: %m"); break; case MANAGER_REEXECUTE: @@ -1876,7 +1876,7 @@ finish: /* And switch root with MS_MOVE, because we remove the old directory afterwards and detach it. */ r = switch_root(switch_root_dir, "/mnt", true, MS_MOVE); if (r < 0) - log_error_errno(-r, "Failed to switch root, trying to continue: %m"); + log_error_errno(r, "Failed to switch root, trying to continue: %m"); } args_size = MAX(6, argc+1); diff --git a/src/core/manager.c b/src/core/manager.c index 94e347ef20..ef58bdd161 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -303,7 +303,7 @@ static int manager_watch_idle_pipe(Manager *m) { r = sd_event_add_io(m->event, &m->idle_pipe_event_source, m->idle_pipe[2], EPOLLIN, manager_dispatch_idle_pipe_fd, m); if (r < 0) { - log_error_errno(-r, "Failed to watch idle pipe: %m"); + log_error_errno(r, "Failed to watch idle pipe: %m"); return r; } @@ -349,7 +349,7 @@ static int manager_setup_time_change(Manager *m) { r = sd_event_add_io(m->event, &m->time_change_event_source, m->time_change_fd, EPOLLIN, manager_dispatch_time_change_fd, m); if (r < 0) { - log_error_errno(-r, "Failed to create time change event source: %m"); + log_error_errno(r, "Failed to create time change event source: %m"); return r; } @@ -697,7 +697,7 @@ static int manager_setup_notify(Manager *m) { if (!m->notify_event_source) { r = sd_event_add_io(m->event, &m->notify_event_source, m->notify_fd, EPOLLIN, manager_dispatch_notify_fd, m); if (r < 0) { - log_error_errno(-r, "Failed to allocate notify event source: %m"); + log_error_errno(r, "Failed to allocate notify event source: %m"); return -errno; } @@ -705,7 +705,7 @@ static int manager_setup_notify(Manager *m) { * still identify to which service an exit message belongs */ r = sd_event_source_set_priority(m->notify_event_source, -7); if (r < 0) { - log_error_errno(-r, "Failed to set priority of notify event source: %m"); + log_error_errno(r, "Failed to set priority of notify event source: %m"); return r; } } @@ -1060,7 +1060,7 @@ static void manager_build_unit_path_cache(Manager *m) { return; fail: - log_error_errno(-r, "Failed to build unit path cache: %m"); + log_error_errno(r, "Failed to build unit path cache: %m"); set_free_free(m->unit_path_cache); m->unit_path_cache = NULL; @@ -1989,7 +1989,7 @@ int manager_loop(Manager *m) { r = sd_event_run(m->event, wait_usec); if (r < 0) { - log_error_errno(-r, "Failed to run event loop: %m"); + log_error_errno(r, "Failed to run event loop: %m"); return r; } } diff --git a/src/core/mount.c b/src/core/mount.c index 9d4513cc18..e6f0a8a2c1 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -1627,7 +1627,7 @@ static int mount_dispatch_io(sd_event_source *source, int fd, uint32_t revents, r = mount_load_proc_self_mountinfo(m, true); if (r < 0) { - log_error_errno(-r, "Failed to reread /proc/self/mountinfo: %m"); + log_error_errno(r, "Failed to reread /proc/self/mountinfo: %m"); /* Reset flags, just in case, for later calls */ LIST_FOREACH(units_by_type, u, m->units_by_type[UNIT_MOUNT]) { diff --git a/src/core/path.c b/src/core/path.c index cd7478f1fc..ca586d9616 100644 --- a/src/core/path.c +++ b/src/core/path.c @@ -250,7 +250,7 @@ static void path_spec_mkdir(PathSpec *s, mode_t mode) { r = mkdir_p_label(s->path, mode); if (r < 0) - log_warning_errno(-r, "mkdir(%s) failed: %m", s->path); + log_warning_errno(r, "mkdir(%s) failed: %m", s->path); } static void path_spec_dump(PathSpec *s, FILE *f, const char *prefix) { diff --git a/src/core/scope.c b/src/core/scope.c index abadd1f827..19b274a267 100644 --- a/src/core/scope.c +++ b/src/core/scope.c @@ -290,7 +290,7 @@ static int scope_start(Unit *u) { r = unit_realize_cgroup(u); if (r < 0) { - log_error_errno(-r, "Failed to realize cgroup: %m"); + log_error_errno(r, "Failed to realize cgroup: %m"); return r; } diff --git a/src/core/shutdown.c b/src/core/shutdown.c index 53c701a8f0..923cd3b16c 100644 --- a/src/core/shutdown.c +++ b/src/core/shutdown.c @@ -240,7 +240,7 @@ int main(int argc, char *argv[]) { } else if (r > 0) log_info("Not all file systems unmounted, %d left.", r); else - log_error_errno(-r, "Failed to unmount file systems: %m"); + log_error_errno(r, "Failed to unmount file systems: %m"); } if (need_swapoff) { @@ -252,7 +252,7 @@ int main(int argc, char *argv[]) { } else if (r > 0) log_info("Not all swaps deactivated, %d left.", r); else - log_error_errno(-r, "Failed to deactivate swaps: %m"); + log_error_errno(r, "Failed to deactivate swaps: %m"); } if (need_loop_detach) { @@ -264,7 +264,7 @@ int main(int argc, char *argv[]) { } else if (r > 0) log_info("Not all loop devices detached, %d left.", r); else - log_error_errno(-r, "Failed to detach loop devices: %m"); + log_error_errno(r, "Failed to detach loop devices: %m"); } if (need_dm_detach) { @@ -276,7 +276,7 @@ int main(int argc, char *argv[]) { } else if (r > 0) log_info("Not all DM devices detached, %d left.", r); else - log_error_errno(-r, "Failed to detach DM devices: %m"); + log_error_errno(r, "Failed to detach DM devices: %m"); } if (!need_umount && !need_swapoff && !need_loop_detach && !need_dm_detach) { @@ -329,7 +329,7 @@ int main(int argc, char *argv[]) { execv("/shutdown", argv); log_error("Failed to execute shutdown binary: %m"); } else - log_error_errno(-r, "Failed to switch root to \"/run/initramfs\": %m"); + log_error_errno(r, "Failed to switch root to \"/run/initramfs\": %m"); } @@ -416,7 +416,7 @@ int main(int argc, char *argv[]) { r = -errno; error: - log_emergency_errno(-r, "Critical error while doing system shutdown: %m"); + log_emergency_errno(r, "Critical error while doing system shutdown: %m"); freeze(); } diff --git a/src/core/socket.c b/src/core/socket.c index 2ee0024590..8f87ef2e8e 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -1506,7 +1506,7 @@ static int socket_chown(Socket *s, pid_t *_pid) { fail_child: log_open(); - log_error_errno(-r, "Failed to chown socket at step %s: %m", exit_status_to_string(ret, EXIT_STATUS_SYSTEMD)); + log_error_errno(r, "Failed to chown socket at step %s: %m", exit_status_to_string(ret, EXIT_STATUS_SYSTEMD)); _exit(ret); } diff --git a/src/core/swap.c b/src/core/swap.c index 0384ebcdbb..e41d77aa54 100644 --- a/src/core/swap.c +++ b/src/core/swap.c @@ -1170,7 +1170,7 @@ static int swap_dispatch_io(sd_event_source *source, int fd, uint32_t revents, v r = swap_load_proc_swaps(m, true); if (r < 0) { - log_error_errno(-r, "Failed to reread /proc/swaps: %m"); + log_error_errno(r, "Failed to reread /proc/swaps: %m"); /* Reset flags, just in case, for late calls */ LIST_FOREACH(units_by_type, u, m->units_by_type[UNIT_SWAP]) { diff --git a/src/core/timer.c b/src/core/timer.c index 819a2608bd..762453880f 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -148,7 +148,7 @@ static int timer_setup_persistent(Timer *t) { r = get_home_dir(&h); if (r < 0) { - log_error_errno(-r, "Failed to determine home directory: %m"); + log_error_errno(r, "Failed to determine home directory: %m"); return r; } diff --git a/src/core/transaction.c b/src/core/transaction.c index 118a242e6e..d378389999 100644 --- a/src/core/transaction.c +++ b/src/core/transaction.c @@ -723,7 +723,7 @@ int transaction_activate(Transaction *tr, Manager *m, JobMode mode, sd_bus_error /* Tenth step: apply changes */ r = transaction_apply(tr, m, mode); if (r < 0) { - log_warning_errno(-r, "Failed to apply transaction: %m"); + log_warning_errno(r, "Failed to apply transaction: %m"); return r; } diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c index c1f167a189..1b408ea447 100644 --- a/src/cryptsetup/cryptsetup-generator.c +++ b/src/cryptsetup/cryptsetup-generator.c @@ -255,7 +255,7 @@ static int create_disk( "# Automatically generated by systemd-cryptsetup-generator \n\n" "[Unit]\nJobTimeoutSec=0"); if (r < 0) { - log_error_errno(-r, "Failed to write device drop-in: %m"); + log_error_errno(r, "Failed to write device drop-in: %m"); return r; } } @@ -327,7 +327,7 @@ int main(int argc, char *argv[]) { z = parse_proc_cmdline(parse_proc_cmdline_item); if (z < 0) - log_warning_errno(-z, "Failed to parse kernel command line, ignoring: %m"); + log_warning_errno(z, "Failed to parse kernel command line, ignoring: %m"); if (!arg_enabled) { r = r2 = EXIT_SUCCESS; diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c index 4afe53138f..487eb111a8 100644 --- a/src/cryptsetup/cryptsetup.c +++ b/src/cryptsetup/cryptsetup.c @@ -281,7 +281,7 @@ static int get_password(const char *name, usec_t until, bool accept_cached, char r = ask_password_auto(text, "drive-harddisk", id, until, accept_cached, passwords); if (r < 0) { - log_error_errno(-r, "Failed to query password: %m"); + log_error_errno(r, "Failed to query password: %m"); return r; } @@ -297,7 +297,7 @@ static int get_password(const char *name, usec_t until, bool accept_cached, char r = ask_password_auto(text, "drive-harddisk", id, until, false, &passwords2); if (r < 0) { - log_error_errno(-r, "Failed to query verification password: %m"); + log_error_errno(r, "Failed to query verification password: %m"); return r; } @@ -355,7 +355,7 @@ static int attach_tcrypt(struct crypt_device *cd, if (key_file) { r = read_one_line_file(key_file, &passphrase); if (r < 0) { - log_error_errno(-r, "Failed to read password file '%s': %m", key_file); + log_error_errno(r, "Failed to read password file '%s': %m", key_file); return -EAGAIN; } @@ -439,7 +439,7 @@ static int attach_luks_or_plain(struct crypt_device *cd, } if (r < 0) { - log_error_errno(-r, "Loading of cryptographic parameters failed: %m"); + log_error_errno(r, "Loading of cryptographic parameters failed: %m"); return r; } @@ -454,7 +454,7 @@ static int attach_luks_or_plain(struct crypt_device *cd, key_file, arg_keyfile_size, arg_keyfile_offset, flags); if (r < 0) { - log_error_errno(-r, "Failed to activate with key file '%s': %m", key_file); + log_error_errno(r, "Failed to activate with key file '%s': %m", key_file); return -EAGAIN; } } else { @@ -567,7 +567,7 @@ int main(int argc, char *argv[]) { k = crypt_init(&cd, argv[3]); if (k) { - log_error_errno(-k, "crypt_init() failed: %m"); + log_error_errno(k, "crypt_init() failed: %m"); goto finish; } @@ -623,7 +623,7 @@ int main(int argc, char *argv[]) { key_file = NULL; continue; } else if (k != -EPERM) { - log_error_errno(-k, "Failed to activate: %m"); + log_error_errno(k, "Failed to activate: %m"); goto finish; } @@ -641,7 +641,7 @@ int main(int argc, char *argv[]) { k = crypt_init_by_name(&cd, argv[2]); if (k) { - log_error_errno(-k, "crypt_init() failed: %m"); + log_error_errno(k, "crypt_init() failed: %m"); goto finish; } @@ -649,7 +649,7 @@ int main(int argc, char *argv[]) { k = crypt_deactivate(cd, argv[2]); if (k < 0) { - log_error_errno(-k, "Failed to deactivate: %m"); + log_error_errno(k, "Failed to deactivate: %m"); goto finish; } diff --git a/src/dbus1-generator/dbus1-generator.c b/src/dbus1-generator/dbus1-generator.c index 4ba1ad131d..a459c8450f 100644 --- a/src/dbus1-generator/dbus1-generator.c +++ b/src/dbus1-generator/dbus1-generator.c @@ -103,7 +103,7 @@ static int create_dbus_files( r = fflush_and_check(f); if (r < 0) { - log_error_errno(-r, "Failed to write %s: %m", a); + log_error_errno(r, "Failed to write %s: %m", a); return r; } @@ -140,7 +140,7 @@ static int create_dbus_files( r = fflush_and_check(f); if (r < 0) { - log_error_errno(-r, "Failed to write %s: %m", b); + log_error_errno(r, "Failed to write %s: %m", b); return r; } @@ -332,7 +332,7 @@ int main(int argc, char *argv[]) { type = "system"; units = SYSTEM_DATA_UNIT_PATH; } else { - log_error_errno(-r, "Failed to determine whether we are running as user or system instance: %m"); + log_error_errno(r, "Failed to determine whether we are running as user or system instance: %m"); return r; } diff --git a/src/debug-generator/debug-generator.c b/src/debug-generator/debug-generator.c index ffafc4da24..4fe64425c0 100644 --- a/src/debug-generator/debug-generator.c +++ b/src/debug-generator/debug-generator.c @@ -152,7 +152,7 @@ int main(int argc, char *argv[]) { r = parse_proc_cmdline(parse_proc_cmdline_item); if (r < 0) - log_warning_errno(-r, "Failed to parse kernel command line, ignoring: %m"); + log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m"); if (arg_debug_shell) { r = strv_extend(&arg_wants, "debug-shell.service"); diff --git a/src/delta/delta.c b/src/delta/delta.c index 2a1ad3d951..1dc81175b5 100644 --- a/src/delta/delta.c +++ b/src/delta/delta.c @@ -227,7 +227,7 @@ static int enumerate_dir_d(Hashmap *top, Hashmap *bottom, Hashmap *drops, const r = get_files_in_directory(path, &list); if (r < 0){ - log_error_errno(-r, "Failed to enumerate %s: %m", path); + log_error_errno(r, "Failed to enumerate %s: %m", path); return r; } diff --git a/src/detect-virt/detect-virt.c b/src/detect-virt/detect-virt.c index d25c48ebfe..9a924117db 100644 --- a/src/detect-virt/detect-virt.c +++ b/src/detect-virt/detect-virt.c @@ -131,7 +131,7 @@ int main(int argc, char *argv[]) { v = detect_virtualization(&id); if (v < 0) { - log_error_errno(-v, "Failed to check for virtualization: %m"); + log_error_errno(v, "Failed to check for virtualization: %m"); return EXIT_FAILURE; } @@ -142,7 +142,7 @@ int main(int argc, char *argv[]) { case ONLY_CONTAINER: r = detect_container(&id); if (r < 0) { - log_error_errno(-r, "Failed to check for container: %m"); + log_error_errno(r, "Failed to check for container: %m"); return EXIT_FAILURE; } @@ -152,7 +152,7 @@ int main(int argc, char *argv[]) { case ONLY_VM: r = detect_vm(&id); if (r < 0) { - log_error_errno(-r, "Failed to check for vm: %m"); + log_error_errno(r, "Failed to check for vm: %m"); return EXIT_FAILURE; } diff --git a/src/efi-boot-generator/efi-boot-generator.c b/src/efi-boot-generator/efi-boot-generator.c index 52d00c0443..d4e9a8c00c 100644 --- a/src/efi-boot-generator/efi-boot-generator.c +++ b/src/efi-boot-generator/efi-boot-generator.c @@ -80,7 +80,7 @@ int main(int argc, char *argv[]) { log_debug("EFI loader partition unknown, exiting."); return EXIT_SUCCESS; } else if (r < 0) { - log_error_errno(-r, "Failed to read ESP partition UUID: %m"); + log_error_errno(r, "Failed to read ESP partition UUID: %m"); return EXIT_FAILURE; } diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c index 1f11a2aec6..ac90bc2631 100644 --- a/src/firstboot/firstboot.c +++ b/src/firstboot/firstboot.c @@ -98,7 +98,7 @@ static void print_welcome(void) { } if (r < 0 && r != -ENOENT) - log_warning_errno(-r, "Failed to read os-release file: %m"); + log_warning_errno(r, "Failed to read os-release file: %m"); printf("\nWelcome to your new installation of %s!\nPlease configure a few basic system settings:\n\n", isempty(pretty_name) ? "Linux" : pretty_name); @@ -167,7 +167,7 @@ static int prompt_loop(const char *text, char **l, bool (*is_valid)(const char * r = ask_string(&p, "%s %s (empty to skip): ", draw_special_char(DRAW_TRIANGULAR_BULLET), text); if (r < 0) { - log_error_errno(-r, "Failed to query user: %m"); + log_error_errno(r, "Failed to query user: %m"); return r; } @@ -220,7 +220,7 @@ static int prompt_locale(void) { r = get_locales(&locales); if (r < 0) { - log_error_errno(-r, "Cannot query locales list: %m"); + log_error_errno(r, "Cannot query locales list: %m"); return r; } @@ -263,7 +263,7 @@ static int process_locale(void) { r = copy_file("/etc/locale.conf", etc_localeconf, 0, 0644); if (r != -ENOENT) { if (r < 0) { - log_error_errno(-r, "Failed to copy %s: %m", etc_localeconf); + log_error_errno(r, "Failed to copy %s: %m", etc_localeconf); return r; } @@ -289,7 +289,7 @@ static int process_locale(void) { mkdir_parents(etc_localeconf, 0755); r = write_env_file(etc_localeconf, locales); if (r < 0) { - log_error_errno(-r, "Failed to write %s: %m", etc_localeconf); + log_error_errno(r, "Failed to write %s: %m", etc_localeconf); return r; } @@ -309,7 +309,7 @@ static int prompt_timezone(void) { r = get_timezones(&zones); if (r < 0) { - log_error_errno(-r, "Cannot query timezone list: %m"); + log_error_errno(r, "Cannot query timezone list: %m"); return r; } @@ -343,7 +343,7 @@ static int process_timezone(void) { r = readlink_malloc("/etc/localtime", &p); if (r != -ENOENT) { if (r < 0) { - log_error_errno(-r, "Failed to read host timezone: %m"); + log_error_errno(r, "Failed to read host timezone: %m"); return r; } @@ -394,7 +394,7 @@ static int prompt_hostname(void) { r = ask_string(&h, "%s Please enter hostname for new system (empty to skip): ", draw_special_char(DRAW_TRIANGULAR_BULLET)); if (r < 0) { - log_error_errno(-r, "Failed to query hostname: %m"); + log_error_errno(r, "Failed to query hostname: %m"); return r; } @@ -434,7 +434,7 @@ static int process_hostname(void) { mkdir_parents(etc_hostname, 0755); r = write_string_file(etc_hostname, arg_hostname); if (r < 0) { - log_error_errno(-r, "Failed to write %s: %m", etc_hostname); + log_error_errno(r, "Failed to write %s: %m", etc_hostname); return r; } @@ -457,7 +457,7 @@ static int process_machine_id(void) { mkdir_parents(etc_machine_id, 0755); r = write_string_file(etc_machine_id, sd_id128_to_string(arg_machine_id, id)); if (r < 0) { - log_error_errno(-r, "Failed to write machine id: %m"); + log_error_errno(r, "Failed to write machine id: %m"); return r; } @@ -490,7 +490,7 @@ static int prompt_root_password(void) { r = ask_password_tty(msg1, 0, false, NULL, &a); if (r < 0) { - log_error_errno(-r, "Failed to query root password: %m"); + log_error_errno(r, "Failed to query root password: %m"); return r; } @@ -501,7 +501,7 @@ static int prompt_root_password(void) { r = ask_password_tty(msg2, 0, false, NULL, &b); if (r < 0) { - log_error_errno(-r, "Failed to query root password: %m"); + log_error_errno(r, "Failed to query root password: %m"); clear_string(a); return r; } @@ -592,7 +592,7 @@ static int process_root_password(void) { r = write_root_shadow(etc_shadow, p); if (r < 0) { - log_error_errno(-r, "Failed to write %s: %m", etc_shadow); + log_error_errno(r, "Failed to write %s: %m", etc_shadow); return r; } @@ -610,7 +610,7 @@ static int process_root_password(void) { r = dev_urandom(raw, 16); if (r < 0) { - log_error_errno(-r, "Failed to get salt: %m"); + log_error_errno(r, "Failed to get salt: %m"); return r; } @@ -636,7 +636,7 @@ static int process_root_password(void) { r = write_root_shadow(etc_shadow, &item); if (r < 0) { - log_error_errno(-r, "Failed to write %s: %m", etc_shadow); + log_error_errno(r, "Failed to write %s: %m", etc_shadow); return r; } @@ -804,7 +804,7 @@ static int parse_argv(int argc, char *argv[]) { r = read_one_line_file(optarg, &arg_root_password); if (r < 0) { - log_error_errno(-r, "Failed to read %s: %m", optarg); + log_error_errno(r, "Failed to read %s: %m", optarg); return r; } @@ -871,7 +871,7 @@ static int parse_argv(int argc, char *argv[]) { r = sd_id128_randomize(&arg_machine_id); if (r < 0) { - log_error_errno(-r, "Failed to generate randomized machine ID: %m"); + log_error_errno(r, "Failed to generate randomized machine ID: %m"); return r; } diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c index f5158735fa..82a833fe78 100644 --- a/src/fsck/fsck.c +++ b/src/fsck/fsck.c @@ -54,7 +54,7 @@ static void start_target(const char *target) { 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; } @@ -238,7 +238,7 @@ int main(int argc, char *argv[]) { q = parse_proc_cmdline(parse_proc_cmdline_item); if (q < 0) - log_warning_errno(-q, "Failed to parse kernel command line, ignoring: %m"); + log_warning_errno(q, "Failed to parse kernel command line, ignoring: %m"); test_files(); @@ -309,7 +309,7 @@ int main(int argc, char *argv[]) { log_info("fsck.%s doesn't exist, not checking file system on %s", type, device); return EXIT_SUCCESS; } else if (r < 0) - log_warning_errno(-r, "fsck.%s cannot be used for %s: %m", type, device); + log_warning_errno(r, "fsck.%s cannot be used for %s: %m", type, device); } if (arg_show_progress) @@ -365,7 +365,7 @@ int main(int argc, char *argv[]) { q = wait_for_terminate(pid, &status); if (q < 0) { - log_error_errno(-q, "waitid(): %m"); + log_error_errno(q, "waitid(): %m"); goto finish; } diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index 1863ab8e89..177ecfa3dc 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -134,7 +134,7 @@ static int add_swap( r = fflush_and_check(f); if (r < 0) { - log_error_errno(-r, "Failed to write unit file %s: %m", unit); + log_error_errno(r, "Failed to write unit file %s: %m", unit); return r; } @@ -600,7 +600,7 @@ int main(int argc, char *argv[]) { r = parse_proc_cmdline(parse_proc_cmdline_item); if (r < 0) - log_warning_errno(-r, "Failed to parse kernel command line, ignoring: %m"); + log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m"); /* Always honour root= and usr= in the kernel command line if we are in an initrd */ if (in_initrd()) { diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c index 7deee3fc44..9803fca420 100644 --- a/src/gpt-auto-generator/gpt-auto-generator.c +++ b/src/gpt-auto-generator/gpt-auto-generator.c @@ -205,7 +205,7 @@ static int add_cryptsetup(const char *id, const char *what, bool rw, char **devi "[Unit]\n" "JobTimeoutSec=0\n"); /* the binary handles timeouts anyway */ if (r < 0) { - log_error_errno(-r, "Failed to write device drop-in: %m"); + log_error_errno(r, "Failed to write device drop-in: %m"); return r; } @@ -488,7 +488,7 @@ static int enumerate_partitions(dev_t devnum) { r = udev_enumerate_scan_devices(e); if (r < 0) { - log_error_errno(-r, "Failed to enumerate partitions on %s: %m", node); + log_error_errno(r, "Failed to enumerate partitions on %s: %m", node); return r; } @@ -713,7 +713,7 @@ static int add_root_mount(void) { log_debug("EFI loader partition unknown, exiting."); return 0; } else if (r < 0) { - log_error_errno(-r, "Failed to read ESP partition UUID: %m"); + log_error_errno(r, "Failed to read ESP partition UUID: %m"); return r; } @@ -740,7 +740,7 @@ static int add_mounts(void) { r = get_block_device("/", &devno); if (r < 0) { - log_error_errno(-r, "Failed to determine block device of root file system: %m"); + log_error_errno(r, "Failed to determine block device of root file system: %m"); return r; } else if (r == 0) { log_debug("Root file system not on a (single) block device."); @@ -774,7 +774,7 @@ int main(int argc, char *argv[]) { r = parse_proc_cmdline(parse_proc_cmdline_item); if (r < 0) - log_warning_errno(-r, "Failed to parse kernel command line, ignoring: %m"); + log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m"); if (!arg_enabled) { log_debug("Disabled, exiting."); diff --git a/src/hibernate-resume/hibernate-resume-generator.c b/src/hibernate-resume/hibernate-resume-generator.c index a2768364ea..b8c4bafc05 100644 --- a/src/hibernate-resume/hibernate-resume-generator.c +++ b/src/hibernate-resume/hibernate-resume-generator.c @@ -88,7 +88,7 @@ int main(int argc, char *argv[]) { r = parse_proc_cmdline(parse_proc_cmdline_item); if (r < 0) - log_warning_errno(-r, "Failed to parse kernel command line, ignoring: %m"); + log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m"); r = process_resume(); free(arg_resume_dev); diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c index 262516e0f9..b1d5ffdb3f 100644 --- a/src/hibernate-resume/hibernate-resume.c +++ b/src/hibernate-resume/hibernate-resume.c @@ -69,7 +69,7 @@ int main(int argc, char *argv[]) { r = write_string_file("/sys/power/resume", major_minor); if (r < 0) { - log_error_errno(-r, "Failed to write '%s' to /sys/power/resume: %m", major_minor); + log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor); return EXIT_FAILURE; } diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c index abbd787d2b..1026e195dc 100644 --- a/src/hostname/hostnamectl.c +++ b/src/hostname/hostnamectl.c @@ -529,7 +529,7 @@ int main(int argc, char *argv[]) { r = bus_open_transport(arg_transport, arg_host, false, &bus); if (r < 0) { - log_error_errno(-r, "Failed to create bus connection: %m"); + log_error_errno(r, "Failed to create bus connection: %m"); goto finish; } diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index edd5c8da37..f04925288a 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -442,7 +442,7 @@ static int method_set_hostname(sd_bus *bus, sd_bus_message *m, void *userdata, s r = context_update_kernel_hostname(c); if (r < 0) { - log_error_errno(-r, "Failed to set host name: %m"); + log_error_errno(r, "Failed to set host name: %m"); return sd_bus_error_set_errnof(error, r, "Failed to set hostname: %s", strerror(-r)); } @@ -494,13 +494,13 @@ static int method_set_static_hostname(sd_bus *bus, sd_bus_message *m, void *user r = context_update_kernel_hostname(c); if (r < 0) { - log_error_errno(-r, "Failed to set host name: %m"); + log_error_errno(r, "Failed to set host name: %m"); return sd_bus_error_set_errnof(error, r, "Failed to set hostname: %s", strerror(-r)); } r = context_write_data_static_hostname(c); if (r < 0) { - log_error_errno(-r, "Failed to write static host name: %m"); + log_error_errno(r, "Failed to write static host name: %m"); return sd_bus_error_set_errnof(error, r, "Failed to set static hostname: %s", strerror(-r)); } @@ -573,7 +573,7 @@ static int set_machine_info(Context *c, sd_bus *bus, sd_bus_message *m, int prop r = context_write_data_machine_info(c); if (r < 0) { - log_error_errno(-r, "Failed to write machine info: %m"); + log_error_errno(r, "Failed to write machine info: %m"); return sd_bus_error_set_errnof(error, r, "Failed to write machine info: %s", strerror(-r)); } @@ -646,25 +646,25 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) { r = sd_bus_default_system(&bus); if (r < 0) { - log_error_errno(-r, "Failed to get system bus connection: %m"); + log_error_errno(r, "Failed to get system bus connection: %m"); return r; } r = sd_bus_add_object_vtable(bus, NULL, "/org/freedesktop/hostname1", "org.freedesktop.hostname1", hostname_vtable, c); if (r < 0) { - log_error_errno(-r, "Failed to register object: %m"); + log_error_errno(r, "Failed to register object: %m"); return r; } r = sd_bus_request_name(bus, "org.freedesktop.hostname1", 0); if (r < 0) { - log_error_errno(-r, "Failed to register name: %m"); + log_error_errno(r, "Failed to register name: %m"); return r; } r = sd_bus_attach_event(bus, event, 0); if (r < 0) { - log_error_errno(-r, "Failed to attach bus to event loop: %m"); + log_error_errno(r, "Failed to attach bus to event loop: %m"); return r; } @@ -701,7 +701,7 @@ int main(int argc, char *argv[]) { r = sd_event_default(&event); if (r < 0) { - log_error_errno(-r, "Failed to allocate event loop: %m"); + log_error_errno(r, "Failed to allocate event loop: %m"); goto finish; } @@ -713,13 +713,13 @@ int main(int argc, char *argv[]) { r = context_read_data(&context); if (r < 0) { - log_error_errno(-r, "Failed to read hostname and machine information: %m"); + log_error_errno(r, "Failed to read hostname and machine information: %m"); goto finish; } r = bus_event_loop_with_idle(event, bus, "org.freedesktop.hostname1", DEFAULT_EXIT_USEC, NULL, NULL); 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/initctl/initctl.c b/src/initctl/initctl.c index 4c7efa74a3..242ad3eca0 100644 --- a/src/initctl/initctl.c +++ b/src/initctl/initctl.c @@ -328,7 +328,7 @@ static int server_init(Server *s, unsigned n_sockets) { r = bus_open_system_systemd(&s->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"); r = -EIO; goto fail; } @@ -355,7 +355,7 @@ static int process_event(Server *s, struct epoll_event *ev) { f = (Fifo*) ev->data.ptr; r = fifo_process(f); if (r < 0) { - log_info_errno(-r, "Got error on fifo: %m"); + log_info_errno(r, "Got error on fifo: %m"); fifo_free(f); return r; } @@ -385,7 +385,7 @@ int main(int argc, char *argv[]) { n = sd_listen_fds(true); if (n < 0) { - log_error_errno(-r, "Failed to read listening file descriptors from environment: %m"); + log_error_errno(r, "Failed to read listening file descriptors from environment: %m"); return EXIT_FAILURE; } diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c index 499a5fc6a2..723b057c1d 100644 --- a/src/journal-remote/journal-gatewayd.c +++ b/src/journal-remote/journal-gatewayd.c @@ -155,14 +155,14 @@ static ssize_t request_reader_entries( r = sd_journal_next(m->journal); if (r < 0) { - log_error_errno(-r, "Failed to advance journal pointer: %m"); + log_error_errno(r, "Failed to advance journal pointer: %m"); return MHD_CONTENT_READER_END_WITH_ERROR; } else if (r == 0) { if (m->follow) { r = sd_journal_wait(m->journal, (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"); return MHD_CONTENT_READER_END_WITH_ERROR; } @@ -177,7 +177,7 @@ static ssize_t request_reader_entries( r = sd_journal_test_cursor(m->journal, m->cursor); if (r < 0) { - log_error_errno(-r, "Failed to test cursor: %m"); + log_error_errno(r, "Failed to test cursor: %m"); return MHD_CONTENT_READER_END_WITH_ERROR; } @@ -205,7 +205,7 @@ static ssize_t request_reader_entries( r = output_journal(m->tmp, m->journal, m->mode, 0, OUTPUT_FULL_WIDTH, NULL); if (r < 0) { - log_error_errno(-r, "Failed to serialize item: %m"); + log_error_errno(r, "Failed to serialize item: %m"); return MHD_CONTENT_READER_END_WITH_ERROR; } @@ -394,7 +394,7 @@ static int request_parse_arguments_iterator( r = sd_id128_get_boot(&bid); if (r < 0) { - log_error_errno(-r, "Failed to get boot ID: %m"); + log_error_errno(r, "Failed to get boot ID: %m"); return MHD_NO; } @@ -543,7 +543,7 @@ static ssize_t request_reader_fields( r = sd_journal_enumerate_unique(m->journal, &d, &l); if (r < 0) { - log_error_errno(-r, "Failed to advance field index: %m"); + log_error_errno(r, "Failed to advance field index: %m"); return MHD_CONTENT_READER_END_WITH_ERROR; } else if (r == 0) return MHD_CONTENT_READER_END_OF_STREAM; @@ -566,7 +566,7 @@ static ssize_t request_reader_fields( r = output_field(m->tmp, m->mode, d, l); if (r < 0) { - log_error_errno(-r, "Failed to serialize item: %m"); + log_error_errno(r, "Failed to serialize item: %m"); return MHD_CONTENT_READER_END_WITH_ERROR; } @@ -910,7 +910,7 @@ static int parse_argv(int argc, char *argv[]) { } r = read_full_file(optarg, &key_pem, NULL); if (r < 0) { - log_error_errno(-r, "Failed to read key file: %m"); + log_error_errno(r, "Failed to read key file: %m"); return r; } assert(key_pem); @@ -923,7 +923,7 @@ static int parse_argv(int argc, char *argv[]) { } r = read_full_file(optarg, &cert_pem, NULL); if (r < 0) { - log_error_errno(-r, "Failed to read certificate file: %m"); + log_error_errno(r, "Failed to read certificate file: %m"); return r; } assert(cert_pem); @@ -937,7 +937,7 @@ static int parse_argv(int argc, char *argv[]) { } r = read_full_file(optarg, &trust_pem, NULL); if (r < 0) { - log_error_errno(-r, "Failed to read CA certificate file: %m"); + log_error_errno(r, "Failed to read CA certificate file: %m"); return r; } assert(trust_pem); @@ -992,7 +992,7 @@ int main(int argc, char *argv[]) { n = sd_listen_fds(1); if (n < 0) { - log_error_errno(-n, "Failed to determine passed sockets: %m"); + log_error_errno(n, "Failed to determine passed sockets: %m"); goto finish; } else if (n > 1) { log_error("Can't listen on more than one socket."); diff --git a/src/journal-remote/journal-remote-write.c b/src/journal-remote/journal-remote-write.c index ac59cb7a17..bfb6a7dcb8 100644 --- a/src/journal-remote/journal-remote-write.c +++ b/src/journal-remote/journal-remote-write.c @@ -153,7 +153,7 @@ int writer_write(Writer *w, return 1; } - log_debug_errno(-r, "%s: Write failed, rotating: %m", w->journal->path); + log_debug_errno(r, "%s: Write failed, rotating: %m", w->journal->path); r = do_rotate(&w->journal, compress, seal); if (r < 0) return r; diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index d2050eff9f..89a680dcb7 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -151,13 +151,13 @@ 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"); + log_error_errno(r, "Failed to split getter option: %m"); return r; } r = strv_extend(&words, url); if (r < 0) { - log_error_errno(-r, "Failed to create command line: %m"); + log_error_errno(r, "Failed to create command line: %m"); return r; } @@ -400,7 +400,7 @@ static int add_source(RemoteServer *s, int fd, char* name, bool own_name) { r = sd_event_source_set_description(source->event, name); if (r < 0) { - log_error_errno(-r, "Failed to set source name for fd:%d: %m", fd); + log_error_errno(r, "Failed to set source name for fd:%d: %m", fd); goto error; } @@ -662,7 +662,7 @@ static int setup_microhttpd_server(RemoteServer *s, r = fd_nonblock(fd, true); if (r < 0) { - log_error_errno(-r, "Failed to make fd:%d nonblocking: %m", fd); + log_error_errno(r, "Failed to make fd:%d nonblocking: %m", fd); return r; } @@ -720,13 +720,13 @@ static int setup_microhttpd_server(RemoteServer *s, epoll_fd, EPOLLIN, dispatch_http_event, d); if (r < 0) { - log_error_errno(-r, "Failed to add event callback: %m"); + log_error_errno(r, "Failed to add event callback: %m"); goto error; } r = sd_event_source_set_description(d->event, "epoll-fd"); if (r < 0) { - log_error_errno(-r, "Failed to set source name: %m"); + log_error_errno(r, "Failed to set source name: %m"); goto error; } @@ -738,7 +738,7 @@ static int setup_microhttpd_server(RemoteServer *s, r = hashmap_put(s->daemons, &d->fd, d); if (r < 0) { - log_error_errno(-r, "Failed to add daemon to hashmap: %m"); + log_error_errno(r, "Failed to add daemon to hashmap: %m"); goto error; } @@ -841,7 +841,7 @@ 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"); + log_error_errno(r, "Failed to allocate event loop: %m"); return r; } @@ -882,7 +882,7 @@ static int remoteserver_init(RemoteServer *s, r = getnameinfo_pretty(fd, &hostname); if (r < 0) { - log_error_errno(-r, "Failed to retrieve remote name: %m"); + log_error_errno(r, "Failed to retrieve remote name: %m"); return r; } @@ -1051,7 +1051,7 @@ static int dispatch_raw_source_event(sd_event_source *event, } else if (r == -EAGAIN) { return 0; } else if (r < 0) { - log_info_errno(-r, "Closing connection: %m"); + log_info_errno(r, "Closing connection: %m"); remove_source(server, fd); return 0; } else @@ -1084,7 +1084,7 @@ static int accept_connection(const char* type, int fd, r = socket_address_print(addr, &a); if (r < 0) { - log_error_errno(-r, "socket_address_print(): %m"); + log_error_errno(r, "socket_address_print(): %m"); close(fd2); return r; } @@ -1542,7 +1542,7 @@ int main(int argc, char **argv) { r = sd_event_set_watchdog(s.events, true); if (r < 0) - log_error_errno(-r, "Failed to enable watchdog: %m"); + log_error_errno(r, "Failed to enable watchdog: %m"); else log_debug("Watchdog is %s.", r > 0 ? "enabled" : "disabled"); @@ -1561,7 +1561,7 @@ int main(int argc, char **argv) { r = sd_event_run(s.events, -1); if (r < 0) { - log_error_errno(-r, "Failed to run event loop: %m"); + log_error_errno(r, "Failed to run event loop: %m"); break; } } diff --git a/src/journal-remote/journal-upload-journal.c b/src/journal-remote/journal-upload-journal.c index 290cfb9f56..ace31af0bf 100644 --- a/src/journal-remote/journal-upload-journal.c +++ b/src/journal-remote/journal-upload-journal.c @@ -26,7 +26,7 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) { r = sd_journal_get_cursor(u->journal, &u->current_cursor); if (r < 0) { - log_error_errno(-r, "Failed to get cursor: %m"); + log_error_errno(r, "Failed to get cursor: %m"); return r; } @@ -52,7 +52,7 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) { r = sd_journal_get_realtime_usec(u->journal, &realtime); 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; } @@ -79,7 +79,7 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) { r = sd_journal_get_monotonic_usec(u->journal, &monotonic, &boot_id); if (r < 0) { - log_error_errno(-r, "Failed to get monotonic timestamp: %m"); + log_error_errno(r, "Failed to get monotonic timestamp: %m"); return r; } @@ -106,7 +106,7 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) { r = sd_journal_get_monotonic_usec(u->journal, NULL, &boot_id); if (r < 0) { - log_error_errno(-r, "Failed to get monotonic timestamp: %m"); + log_error_errno(r, "Failed to get monotonic timestamp: %m"); return r; } @@ -305,7 +305,7 @@ static int process_journal_input(Uploader *u, int skip) { r = sd_journal_next_skip(u->journal, skip); if (r < 0) { - log_error_errno(-r, "Failed to skip to next entry: %m"); + log_error_errno(r, "Failed to skip to next entry: %m"); return r; } else if (r < skip) return 0; @@ -321,7 +321,7 @@ int check_journal_input(Uploader *u) { r = sd_journal_process(u->journal); if (r < 0) { - log_error_errno(-r, "Failed to process journal: %m"); + log_error_errno(r, "Failed to process journal: %m"); close_journal_input(u); return r; } @@ -364,7 +364,7 @@ int open_journal_for_upload(Uploader *u, if (follow) { fd = sd_journal_get_fd(j); if (fd < 0) { - log_error_errno(-fd, "sd_journal_get_fd failed: %m"); + log_error_errno(fd, "sd_journal_get_fd failed: %m"); return fd; } @@ -380,7 +380,7 @@ int open_journal_for_upload(Uploader *u, r = sd_event_add_io(u->events, &u->input_event, fd, events, dispatch_journal_input, u); if (r < 0) { - log_error_errno(-r, "Failed to register input event: %m"); + log_error_errno(r, "Failed to register input event: %m"); return r; } diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index 36c0241d02..0b9a817b23 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -147,7 +147,7 @@ static int update_cursor_state(Uploader *u) { finish: if (r < 0) - log_error_errno(-r, "Failed to save state %s: %m", u->state_file); + log_error_errno(r, "Failed to save state %s: %m", u->state_file); return r; } @@ -375,7 +375,7 @@ static int open_file_for_upload(Uploader *u, const char *filename) { fd, EPOLLIN, dispatch_fd_input, u); if (r < 0) { if (r != -EPERM || arg_follow > 0) { - log_error_errno(-r, "Failed to register input event: %m"); + log_error_errno(r, "Failed to register input event: %m"); return r; } @@ -459,13 +459,13 @@ static int setup_uploader(Uploader *u, const char *url, const char *state_file) r = sd_event_default(&u->events); if (r < 0) { - log_error_errno(-r, "sd_event_default failed: %m"); + log_error_errno(r, "sd_event_default failed: %m"); return r; } r = setup_signals(u); if (r < 0) { - log_error_errno(-r, "Failed to set up signals: %m"); + log_error_errno(r, "Failed to set up signals: %m"); return r; } @@ -702,7 +702,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; @@ -869,7 +869,7 @@ int main(int argc, char **argv) { r = sd_event_run(u.events, u.timeout); if (r < 0) { - log_error_errno(-r, "Failed to run event loop: %m"); + log_error_errno(r, "Failed to run event loop: %m"); break; } } diff --git a/src/journal-remote/microhttpd-util.c b/src/journal-remote/microhttpd-util.c index 3df34b2323..03a594cffb 100644 --- a/src/journal-remote/microhttpd-util.c +++ b/src/journal-remote/microhttpd-util.c @@ -171,14 +171,14 @@ static int verify_cert_authorized(gnutls_session_t session) { r = gnutls_certificate_verify_peers2(session, &status); if (r < 0) { - log_error_errno(-r, "gnutls_certificate_verify_peers2 failed: %m"); + log_error_errno(r, "gnutls_certificate_verify_peers2 failed: %m"); return r; } 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"); + log_error_errno(r, "gnutls_certificate_verification_status_print failed: %m"); return r; } 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; } diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c index e5ffa90d7f..9e24b6ab71 100644 --- a/src/libsystemd-network/sd-dhcp-lease.c +++ b/src/libsystemd-network/sd-dhcp-lease.c @@ -685,7 +685,7 @@ int sd_dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) { finish: if (r < 0) - log_error_errno(-r, "Failed to save lease data %s: %m", lease_file); + log_error_errno(r, "Failed to save lease data %s: %m", lease_file); return r; } @@ -725,7 +725,7 @@ int sd_dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) { if (r == -ENOENT) return 0; - log_error_errno(-r, "Failed to read %s: %m", lease_file); + log_error_errno(r, "Failed to read %s: %m", lease_file); return r; } diff --git a/src/libsystemd-network/sd-pppoe.c b/src/libsystemd-network/sd-pppoe.c index 9fb6f5382c..4f49b799ec 100644 --- a/src/libsystemd-network/sd-pppoe.c +++ b/src/libsystemd-network/sd-pppoe.c @@ -422,7 +422,7 @@ static int pppoe_timeout(sd_event_source *s, uint64_t usec, void *userdata) { case PPPOE_STATE_INITIALIZING: r = pppoe_send_initiation(ppp); if (r < 0) - log_warning_errno(-r, "PPPoE: sending PADI failed: %m"); + log_warning_errno(r, "PPPoE: sending PADI failed: %m"); break; case PPPOE_STATE_REQUESTING: @@ -431,14 +431,14 @@ static int pppoe_timeout(sd_event_source *s, uint64_t usec, void *userdata) { r = pppoe_send_initiation(ppp); if (r < 0) - log_warning_errno(-r, "PPPoE: sending PADI failed: %m"); + log_warning_errno(r, "PPPoE: sending PADI failed: %m"); ppp->padr_resend_count = PPPOE_MAX_PADR_RESEND; ppp->state = PPPOE_STATE_INITIALIZING; } else { r = pppoe_send_request(ppp); if (r < 0) - log_warning_errno(-r, "PPPoE: sending PADR failed: %m"); + log_warning_errno(r, "PPPoE: sending PADR failed: %m"); } break; @@ -716,7 +716,7 @@ static int pppoe_receive_message(sd_event_source *s, int fd, uint32_t revents, v len = recvfrom(fd, packet, buflen, 0, &link.sa, &addrlen); if (len < 0) { - log_warning_errno(-r, "PPPoE: could not receive message from raw socket: %m"); + log_warning_errno(r, "PPPoE: could not receive message from raw socket: %m"); return 0; } else if ((size_t)len < sizeof(struct pppoe_hdr)) return 0; diff --git a/src/libsystemd-terminal/evcat.c b/src/libsystemd-terminal/evcat.c index 08c872ab83..b0b1a197ed 100644 --- a/src/libsystemd-terminal/evcat.c +++ b/src/libsystemd-terminal/evcat.c @@ -138,13 +138,13 @@ static int evcat_new(Evcat **out) { r = sd_pid_get_session(getpid(), &e->session); if (r < 0) { - log_error_errno(-r, "Cannot retrieve logind session: %m"); + log_error_errno(r, "Cannot retrieve logind session: %m"); return r; } r = sd_session_get_seat(e->session, &e->seat); if (r < 0) { - log_error_errno(-r, "Cannot retrieve seat of logind session: %m"); + log_error_errno(r, "Cannot retrieve seat of logind session: %m"); return r; } @@ -319,14 +319,14 @@ static int evcat_sysview_fn(sysview_context *c, void *userdata, sysview_event *e evcat_idev_fn, e); if (r < 0) { - log_error_errno(-r, "Cannot create idev session: %m"); + log_error_errno(r, "Cannot create idev session: %m"); return r; } if (e->managed) { r = sysview_session_take_control(ev->session_add.session); if (r < 0) { - log_error_errno(-r, "Cannot request session control: %m"); + log_error_errno(r, "Cannot request session control: %m"); return r; } } @@ -346,7 +346,7 @@ static int evcat_sysview_fn(sysview_context *c, void *userdata, sysview_event *e if (type == SYSVIEW_DEVICE_EVDEV) { r = idev_session_add_evdev(e->idev_session, sysview_device_get_ud(d)); if (r < 0) { - log_error_errno(-r, "Cannot add evdev device to idev: %m"); + log_error_errno(r, "Cannot add evdev device to idev: %m"); return r; } } @@ -358,7 +358,7 @@ static int evcat_sysview_fn(sysview_context *c, void *userdata, sysview_event *e if (type == SYSVIEW_DEVICE_EVDEV) { r = idev_session_remove_evdev(e->idev_session, sysview_device_get_ud(d)); if (r < 0) { - log_error_errno(-r, "Cannot remove evdev device from idev: %m"); + log_error_errno(r, "Cannot remove evdev device from idev: %m"); return r; } } @@ -367,7 +367,7 @@ static int evcat_sysview_fn(sysview_context *c, void *userdata, sysview_event *e case SYSVIEW_EVENT_SESSION_CONTROL: r = ev->session_control.error; if (r < 0) { - log_error_errno(-r, "Cannot acquire session control: %m"); + log_error_errno(r, "Cannot acquire session control: %m"); return r; } diff --git a/src/libsystemd-terminal/idev-keyboard.c b/src/libsystemd-terminal/idev-keyboard.c index 2179fd335d..a26a49a80d 100644 --- a/src/libsystemd-terminal/idev-keyboard.c +++ b/src/libsystemd-terminal/idev-keyboard.c @@ -377,7 +377,7 @@ static int kbdctx_set_locale(sd_bus *bus, const char *member, sd_bus_message *m, error: if (r < 0) - log_debug_errno(-r, "idev-keyboard: cannot parse locale property from locale1: %m"); + log_debug_errno(r, "idev-keyboard: cannot parse locale property from locale1: %m"); return r; } @@ -448,7 +448,7 @@ static int kbdctx_query_locale(kbdctx *kc) { return 0; error: - log_debug_errno(-r, "idev-keyboard: cannot send GetAll to locale1: %m"); + log_debug_errno(r, "idev-keyboard: cannot send GetAll to locale1: %m"); return r; } @@ -480,7 +480,7 @@ static int kbdctx_locale_props_changed_fn(sd_bus *bus, return 0; error: - log_debug_errno(-r, "idev-keyboard: cannot handle PropertiesChanged from locale1: %m"); + log_debug_errno(r, "idev-keyboard: cannot handle PropertiesChanged from locale1: %m"); return r; } @@ -497,7 +497,7 @@ static int kbdctx_setup_bus(kbdctx *kc) { kbdctx_locale_props_changed_fn, kc); if (r < 0) { - log_debug_errno(-r, "idev-keyboard: cannot setup locale1 link: %m"); + log_debug_errno(r, "idev-keyboard: cannot setup locale1 link: %m"); return r; } diff --git a/src/libsystemd-terminal/modeset.c b/src/libsystemd-terminal/modeset.c index 9871e306e4..54faec8fee 100644 --- a/src/libsystemd-terminal/modeset.c +++ b/src/libsystemd-terminal/modeset.c @@ -147,13 +147,13 @@ static int modeset_new(Modeset **out) { r = sd_pid_get_session(getpid(), &m->session); if (r < 0) { - log_error_errno(-r, "Cannot retrieve logind session: %m"); + log_error_errno(r, "Cannot retrieve logind session: %m"); return r; } r = sd_session_get_seat(m->session, &m->seat); if (r < 0) { - log_error_errno(-r, "Cannot retrieve seat of logind session: %m"); + log_error_errno(r, "Cannot retrieve seat of logind session: %m"); return r; } @@ -310,14 +310,14 @@ static int modeset_sysview_fn(sysview_context *c, void *userdata, sysview_event modeset_grdev_fn, m); if (r < 0) { - log_error_errno(-r, "Cannot create grdev session: %m"); + log_error_errno(r, "Cannot create grdev session: %m"); return r; } if (m->managed) { r = sysview_session_take_control(ev->session_add.session); if (r < 0) { - log_error_errno(-r, "Cannot request session control: %m"); + log_error_errno(r, "Cannot request session control: %m"); return r; } } @@ -359,7 +359,7 @@ static int modeset_sysview_fn(sysview_context *c, void *userdata, sysview_event case SYSVIEW_EVENT_SESSION_CONTROL: r = ev->session_control.error; if (r < 0) { - log_error_errno(-r, "Cannot acquire session control: %m"); + log_error_errno(r, "Cannot acquire session control: %m"); return r; } diff --git a/src/libsystemd-terminal/subterm.c b/src/libsystemd-terminal/subterm.c index ef112d4014..97a98a9843 100644 --- a/src/libsystemd-terminal/subterm.c +++ b/src/libsystemd-terminal/subterm.c @@ -126,7 +126,7 @@ static int output_flush(Output *o) { len = loop_write(o->fd, o->obuf, o->n_obuf, false); if (len < 0) { - log_error_errno(-len, "error: cannot write to TTY (%zd): %m", len); + log_error_errno(len, "error: cannot write to TTY (%zd): %m", len); return len; } @@ -157,7 +157,7 @@ static int output_write(Output *o, const void *buf, size_t size) { len = loop_write(o->fd, buf, size, false); if (len < 0) { - log_error_errno(-len, "error: cannot write to TTY (%zd): %m", len); + log_error_errno(len, "error: cannot write to TTY (%zd): %m", len); return len; } @@ -612,12 +612,12 @@ static int terminal_winch_fn(sd_event_source *source, const struct signalfd_sigi if (t->pty) { r = pty_resize(t->pty, t->output->in_width, t->output->in_height); if (r < 0) - log_error_errno(-r, "error: pty_resize() (%d): %m", r); + log_error_errno(r, "error: pty_resize() (%d): %m", r); } r = term_screen_resize(t->screen, t->output->in_width, t->output->in_height); if (r < 0) - log_error_errno(-r, "error: term_screen_resize() (%d): %m", r); + log_error_errno(r, "error: term_screen_resize() (%d): %m", r); terminal_dirty(t); @@ -657,7 +657,7 @@ static int terminal_write_tmp(Terminal *t) { for (i = 0; i < num; ++i) { r = pty_write(t->pty, vec[i].iov_base, vec[i].iov_len); if (r < 0) { - log_error_errno(-r, "error: cannot write to PTY (%d): %m", r); + log_error_errno(r, "error: cannot write to PTY (%d): %m", r); return r; } } @@ -726,7 +726,7 @@ static int terminal_io_fn(sd_event_source *source, int fd, uint32_t revents, voi for (j = 0; j < n_str; ++j) { type = term_parser_feed(t->parser, &seq, str[j]); if (type < 0) { - log_error_errno(-type, "error: term_parser_feed() (%d): %m", type); + log_error_errno(type, "error: term_parser_feed() (%d): %m", type); return type; } @@ -778,7 +778,7 @@ static int terminal_pty_fn(Pty *pty, void *userdata, unsigned int event, const v case PTY_DATA: r = term_screen_feed_text(t->screen, ptr, size); if (r < 0) { - log_error_errno(-r, "error: term_screen_feed_text() (%d): %m", r); + log_error_errno(r, "error: term_screen_feed_text() (%d): %m", r); return r; } @@ -857,49 +857,49 @@ static int terminal_new(Terminal **out, int in_fd, int out_fd) { r = tcsetattr(t->in_fd, TCSANOW, &in_attr); if (r < 0) { - log_error_errno(-r, "error: tcsetattr() (%d): %m", r); + log_error_errno(r, "error: tcsetattr() (%d): %m", r); goto error; } r = tcsetattr(t->out_fd, TCSANOW, &out_attr); if (r < 0) { - log_error_errno(-r, "error: tcsetattr() (%d): %m", r); + log_error_errno(r, "error: tcsetattr() (%d): %m", r); goto error; } r = sd_event_default(&t->event); if (r < 0) { - log_error_errno(-r, "error: sd_event_default() (%d): %m", r); + log_error_errno(r, "error: sd_event_default() (%d): %m", r); goto error; } r = sigprocmask_many(SIG_BLOCK, SIGINT, SIGQUIT, SIGTERM, SIGWINCH, SIGCHLD, -1); if (r < 0) { - log_error_errno(-r, "error: sigprocmask_many() (%d): %m", r); + log_error_errno(r, "error: sigprocmask_many() (%d): %m", r); goto error; } r = sd_event_add_signal(t->event, NULL, SIGINT, NULL, NULL); if (r < 0) { - log_error_errno(-r, "error: sd_event_add_signal() (%d): %m", r); + log_error_errno(r, "error: sd_event_add_signal() (%d): %m", r); goto error; } r = sd_event_add_signal(t->event, NULL, SIGQUIT, NULL, NULL); if (r < 0) { - log_error_errno(-r, "error: sd_event_add_signal() (%d): %m", r); + log_error_errno(r, "error: sd_event_add_signal() (%d): %m", r); goto error; } r = sd_event_add_signal(t->event, NULL, SIGTERM, NULL, NULL); if (r < 0) { - log_error_errno(-r, "error: sd_event_add_signal() (%d): %m", r); + log_error_errno(r, "error: sd_event_add_signal() (%d): %m", r); goto error; } r = sd_event_add_signal(t->event, NULL, SIGWINCH, terminal_winch_fn, t); if (r < 0) { - log_error_errno(-r, "error: sd_event_add_signal() (%d): %m", r); + log_error_errno(r, "error: sd_event_add_signal() (%d): %m", r); goto error; } @@ -907,7 +907,7 @@ static int terminal_new(Terminal **out, int in_fd, int out_fd) { t->is_dirty = true; r = sd_event_add_time(t->event, &t->frame_timer, CLOCK_MONOTONIC, 0, 0, terminal_frame_timer_fn, t); if (r < 0) { - log_error_errno(-r, "error: sd_event_add_time() (%d): %m", r); + log_error_errno(r, "error: sd_event_add_time() (%d): %m", r); goto error; } @@ -929,7 +929,7 @@ static int terminal_new(Terminal **out, int in_fd, int out_fd) { r = term_screen_resize(t->screen, t->output->in_width, t->output->in_height); if (r < 0) { - log_error_errno(-r, "error: term_screen_resize() (%d): %m", r); + log_error_errno(r, "error: term_screen_resize() (%d): %m", r); goto error; } @@ -952,7 +952,7 @@ static int terminal_run(Terminal *t) { pid = pty_fork(&t->pty, t->event, terminal_pty_fn, t, t->output->in_width, t->output->in_height); if (pid < 0) { - log_error_errno(-pid, "error: cannot fork PTY (%d): %m", pid); + log_error_errno(pid, "error: cannot fork PTY (%d): %m", pid); return pid; } else if (pid == 0) { /* child */ @@ -993,7 +993,7 @@ int main(int argc, char *argv[]) { out: if (r < 0) - log_error_errno(-r, "error: terminal failed (%d): %m", r); + log_error_errno(r, "error: terminal failed (%d): %m", r); terminal_free(t); return -r; } diff --git a/src/libsystemd-terminal/sysview.c b/src/libsystemd-terminal/sysview.c index 2eab289c41..9eb659777a 100644 --- a/src/libsystemd-terminal/sysview.c +++ b/src/libsystemd-terminal/sysview.c @@ -1498,7 +1498,7 @@ static int context_scan_fn(sd_event_source *s, void *userdata) { if (!c->scanned) { r = context_ld_scan(c); if (r < 0) { - log_debug_errno(-r, "sysview: logind scan failed: %m"); + log_debug_errno(r, "sysview: logind scan failed: %m"); return r; } } @@ -1507,7 +1507,7 @@ static int context_scan_fn(sd_event_source *s, void *userdata) { if (hashmap_size(c->session_map) > 0) { r = context_ud_scan(c); if (r < 0) { - log_debug_errno(-r, "sysview: udev scan failed: %m"); + log_debug_errno(r, "sysview: udev scan failed: %m"); return r; } diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c index 54716bd904..b57ac41e05 100644 --- a/src/libsystemd/sd-bus/bus-dump.c +++ b/src/libsystemd/sd-bus/bus-dump.c @@ -126,7 +126,7 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) { r = sd_bus_message_rewind(m, !(flags & BUS_MESSAGE_DUMP_SUBTREE_ONLY)); if (r < 0) { - log_error_errno(-r, "Failed to rewind: %m"); + log_error_errno(r, "Failed to rewind: %m"); return r; } @@ -152,7 +152,7 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) { r = sd_bus_message_peek_type(m, &type, &contents); if (r < 0) { - log_error_errno(-r, "Failed to peek type: %m"); + log_error_errno(r, "Failed to peek type: %m"); return r; } @@ -162,7 +162,7 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) { r = sd_bus_message_exit_container(m); if (r < 0) { - log_error_errno(-r, "Failed to exit container: %m"); + log_error_errno(r, "Failed to exit container: %m"); return r; } @@ -183,7 +183,7 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) { if (bus_type_is_container(type) > 0) { r = sd_bus_message_enter_container(m, type, contents); if (r < 0) { - log_error_errno(-r, "Failed to enter container: %m"); + log_error_errno(r, "Failed to enter container: %m"); return r; } @@ -203,7 +203,7 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) { r = sd_bus_message_read_basic(m, type, &basic); if (r < 0) { - log_error_errno(-r, "Failed to get basic: %m"); + log_error_errno(r, "Failed to get basic: %m"); return r; } diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index fe150ccdae..5b4bbfd1ea 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -1059,7 +1059,7 @@ int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m, bool hint_sync_call /* Anybody can send us invalid messages, let's just drop them. */ if (r == -EBADMSG || r == -EPROTOTYPE) - log_debug_errno(-r, "Ignoring invalid message: %m"); + log_debug_errno(r, "Ignoring invalid message: %m"); else return r; } @@ -1243,7 +1243,7 @@ int bus_kernel_read_message(sd_bus *bus, bool hint_priority, int64_t priority) { /* Anybody can send us invalid messages, let's just drop them. */ if (r == -EBADMSG || r == -EPROTOTYPE) { - log_debug_errno(-r, "Ignoring invalid message: %m"); + log_debug_errno(r, "Ignoring invalid message: %m"); r = 0; } diff --git a/src/libsystemd/sd-bus/bus-track.c b/src/libsystemd/sd-bus/bus-track.c index 0b2f2a9059..6be8310bbe 100644 --- a/src/libsystemd/sd-bus/bus-track.c +++ b/src/libsystemd/sd-bus/bus-track.c @@ -309,7 +309,7 @@ void bus_track_dispatch(sd_bus_track *track) { r = track->handler(track, track->userdata); if (r < 0) - log_debug_errno(-r, "Failed to process track handler: %m"); + log_debug_errno(r, "Failed to process track handler: %m"); else if (r == 0) bus_track_add_to_queue(track); diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c index 4b5c1a6d36..22a3766a02 100644 --- a/src/libsystemd/sd-bus/bus-util.c +++ b/src/libsystemd/sd-bus/bus-util.c @@ -1263,12 +1263,12 @@ int bus_property_get_ulong( #endif int bus_log_parse_error(int r) { - log_error_errno(-r, "Failed to parse bus message: %m"); + log_error_errno(r, "Failed to parse bus message: %m"); return r; } int bus_log_create_error(int r) { - log_error_errno(-r, "Failed to create bus message: %m"); + log_error_errno(r, "Failed to create bus message: %m"); return r; } diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c index 8cc309c01b..b4a91dfed3 100644 --- a/src/libsystemd/sd-bus/busctl.c +++ b/src/libsystemd/sd-bus/busctl.c @@ -90,7 +90,7 @@ static int list_bus_names(sd_bus *bus, char **argv) { r = sd_bus_list_names(bus, (arg_acquired || arg_unique) ? &acquired : NULL, arg_activatable ? &activatable : NULL); if (r < 0) { - log_error_errno(-r, "Failed to list names: %m"); + log_error_errno(r, "Failed to list names: %m"); return r; } @@ -105,7 +105,7 @@ static int list_bus_names(sd_bus *bus, char **argv) { r = hashmap_put(names, *i, NAME_IS_ACQUIRED); if (r < 0) { - log_error_errno(-r, "Failed to add to hashmap: %m"); + log_error_errno(r, "Failed to add to hashmap: %m"); return r; } } @@ -115,7 +115,7 @@ static int list_bus_names(sd_bus *bus, char **argv) { r = hashmap_put(names, *i, NAME_IS_ACTIVATABLE); if (r < 0 && r != -EEXIST) { - log_error_errno(-r, "Failed to add to hashmap: %m"); + log_error_errno(r, "Failed to add to hashmap: %m"); return r; } } @@ -439,7 +439,7 @@ static int tree(sd_bus *bus, char **argv) { r = sd_bus_list_names(bus, &names, NULL); if (r < 0) { - log_error_errno(-r, "Failed to get name list: %m"); + log_error_errno(r, "Failed to get name list: %m"); return r; } @@ -1096,7 +1096,7 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL r = sd_bus_add_match(bus, NULL, m, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Failed to add match: %m"); + log_error_errno(r, "Failed to add match: %m"); return r; } @@ -1106,7 +1106,7 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL STRV_FOREACH(i, arg_matches) { r = sd_bus_add_match(bus, NULL, *i, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Failed to add match: %m"); + log_error_errno(r, "Failed to add match: %m"); return r; } @@ -1116,7 +1116,7 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL if (!added_something) { r = sd_bus_add_match(bus, NULL, "", NULL, NULL); if (r < 0) { - log_error_errno(-r, "Failed to add match: %m"); + log_error_errno(r, "Failed to add match: %m"); return r; } } @@ -1126,7 +1126,7 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL r = sd_bus_process(bus, &m); if (r < 0) { - log_error_errno(-r, "Failed to process bus: %m"); + log_error_errno(r, "Failed to process bus: %m"); return r; } @@ -1140,7 +1140,7 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL r = sd_bus_wait(bus, (uint64_t) -1); if (r < 0) { - log_error_errno(-r, "Failed to wait for bus: %m"); + log_error_errno(r, "Failed to wait for bus: %m"); return r; } } @@ -1200,7 +1200,7 @@ static int status(sd_bus *bus, char *argv[]) { &creds); if (r < 0) { - log_error_errno(-r, "Failed to get credentials: %m"); + log_error_errno(r, "Failed to get credentials: %m"); return r; } @@ -1962,7 +1962,7 @@ int main(int argc, char *argv[]) { r = sd_bus_new(&bus); if (r < 0) { - log_error_errno(-r, "Failed to allocate bus: %m"); + log_error_errno(r, "Failed to allocate bus: %m"); goto finish; } @@ -1971,25 +1971,25 @@ int main(int argc, char *argv[]) { r = sd_bus_set_monitor(bus, true); if (r < 0) { - log_error_errno(-r, "Failed to set monitor mode: %m"); + log_error_errno(r, "Failed to set monitor mode: %m"); goto finish; } r = sd_bus_negotiate_creds(bus, true, _SD_BUS_CREDS_ALL); if (r < 0) { - log_error_errno(-r, "Failed to enable credentials: %m"); + log_error_errno(r, "Failed to enable credentials: %m"); goto finish; } r = sd_bus_negotiate_timestamp(bus, true); if (r < 0) { - log_error_errno(-r, "Failed to enable timestamps: %m"); + log_error_errno(r, "Failed to enable timestamps: %m"); goto finish; } r = sd_bus_negotiate_fds(bus, true); if (r < 0) { - log_error_errno(-r, "Failed to enable fds: %m"); + log_error_errno(r, "Failed to enable fds: %m"); goto finish; } } @@ -1999,7 +1999,7 @@ int main(int argc, char *argv[]) { else { r = sd_bus_set_bus_client(bus, true); if (r < 0) { - log_error_errno(-r, "Failed to set bus client: %m"); + log_error_errno(r, "Failed to set bus client: %m"); goto finish; } @@ -2025,13 +2025,13 @@ int main(int argc, char *argv[]) { } } if (r < 0) { - log_error_errno(-r, "Failed to set address: %m"); + log_error_errno(r, "Failed to set address: %m"); goto finish; } r = sd_bus_start(bus); if (r < 0) { - log_error_errno(-r, "Failed to connect to bus: %m"); + log_error_errno(r, "Failed to connect to bus: %m"); goto finish; } diff --git a/src/libsystemd/sd-bus/test-bus-chat.c b/src/libsystemd/sd-bus/test-bus-chat.c index 7703878982..dfc54560af 100644 --- a/src/libsystemd/sd-bus/test-bus-chat.c +++ b/src/libsystemd/sd-bus/test-bus-chat.c @@ -54,7 +54,7 @@ static int object_callback(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bu r = sd_bus_reply_method_return(m, NULL); if (r < 0) { - log_error_errno(-r, "Failed to send reply: %m"); + log_error_errno(r, "Failed to send reply: %m"); return r; } @@ -74,19 +74,19 @@ static int server_init(sd_bus **_bus) { r = sd_bus_open_user(&bus); if (r < 0) { - log_error_errno(-r, "Failed to connect to user bus: %m"); + log_error_errno(r, "Failed to connect to user bus: %m"); goto fail; } r = sd_bus_get_owner_id(bus, &id); if (r < 0) { - log_error_errno(-r, "Failed to get server ID: %m"); + log_error_errno(r, "Failed to get server ID: %m"); goto fail; } r = sd_bus_get_unique_name(bus, &unique); if (r < 0) { - log_error_errno(-r, "Failed to get unique name: %m"); + log_error_errno(r, "Failed to get unique name: %m"); goto fail; } @@ -96,25 +96,25 @@ static int server_init(sd_bus **_bus) { r = sd_bus_request_name(bus, "org.freedesktop.systemd.test", 0); if (r < 0) { - log_error_errno(-r, "Failed to acquire name: %m"); + log_error_errno(r, "Failed to acquire name: %m"); goto fail; } r = sd_bus_add_fallback(bus, NULL, "/foo/bar", object_callback, NULL); if (r < 0) { - log_error_errno(-r, "Failed to add object: %m"); + log_error_errno(r, "Failed to add object: %m"); goto fail; } r = sd_bus_add_match(bus, NULL, "type='signal',interface='foo.bar',member='Notify'", match_callback, NULL); if (r < 0) { - log_error_errno(-r, "Failed to add match: %m"); + log_error_errno(r, "Failed to add match: %m"); goto fail; } r = sd_bus_add_match(bus, NULL, "type='signal',interface='org.freedesktop.DBus',member='NameOwnerChanged'", match_callback, NULL); if (r < 0) { - log_error_errno(-r, "Failed to add match: %m"); + log_error_errno(r, "Failed to add match: %m"); goto fail; } @@ -141,14 +141,14 @@ static int server(sd_bus *bus) { r = sd_bus_process(bus, &m); if (r < 0) { - log_error_errno(-r, "Failed to process requests: %m"); + log_error_errno(r, "Failed to process requests: %m"); goto fail; } if (r == 0) { r = sd_bus_wait(bus, (uint64_t) -1); if (r < 0) { - log_error_errno(-r, "Failed to wait: %m"); + log_error_errno(r, "Failed to wait: %m"); goto fail; } @@ -173,7 +173,7 @@ static int server(sd_bus *bus) { r = sd_bus_message_read(m, "s", &hello); if (r < 0) { - log_error_errno(-r, "Failed to get parameter: %m"); + log_error_errno(r, "Failed to get parameter: %m"); goto fail; } @@ -187,14 +187,14 @@ static int server(sd_bus *bus) { r = sd_bus_reply_method_return(m, "s", lowercase); if (r < 0) { - log_error_errno(-r, "Failed to send reply: %m"); + log_error_errno(r, "Failed to send reply: %m"); goto fail; } } else if (sd_bus_message_is_method_call(m, "org.freedesktop.systemd.test", "ExitClient1")) { r = sd_bus_reply_method_return(m, NULL); if (r < 0) { - log_error_errno(-r, "Failed to send reply: %m"); + log_error_errno(r, "Failed to send reply: %m"); goto fail; } @@ -203,7 +203,7 @@ static int server(sd_bus *bus) { r = sd_bus_reply_method_return(m, NULL); if (r < 0) { - log_error_errno(-r, "Failed to send reply: %m"); + log_error_errno(r, "Failed to send reply: %m"); goto fail; } @@ -214,7 +214,7 @@ static int server(sd_bus *bus) { r = sd_bus_reply_method_return(m, NULL); if (r < 0) { - log_error_errno(-r, "Failed to send reply: %m"); + log_error_errno(r, "Failed to send reply: %m"); goto fail; } @@ -224,7 +224,7 @@ static int server(sd_bus *bus) { r = sd_bus_message_read(m, "h", &fd); if (r < 0) { - log_error_errno(-r, "Failed to get parameter: %m"); + log_error_errno(r, "Failed to get parameter: %m"); goto fail; } @@ -238,7 +238,7 @@ static int server(sd_bus *bus) { r = sd_bus_reply_method_return(m, NULL); if (r < 0) { - log_error_errno(-r, "Failed to send reply: %m"); + log_error_errno(r, "Failed to send reply: %m"); goto fail; } @@ -248,7 +248,7 @@ static int server(sd_bus *bus) { m, &SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_UNKNOWN_METHOD, "Unknown method.")); if (r < 0) { - log_error_errno(-r, "Failed to send reply: %m"); + log_error_errno(r, "Failed to send reply: %m"); goto fail; } } @@ -276,7 +276,7 @@ static void* client1(void*p) { r = sd_bus_open_user(&bus); if (r < 0) { - log_error_errno(-r, "Failed to connect to user bus: %m"); + log_error_errno(r, "Failed to connect to user bus: %m"); goto finish; } @@ -291,13 +291,13 @@ static void* client1(void*p) { "s", "HELLO"); if (r < 0) { - log_error_errno(-r, "Failed to issue method call: %m"); + log_error_errno(r, "Failed to issue method call: %m"); goto finish; } r = sd_bus_message_read(reply, "s", &hello); if (r < 0) { - log_error_errno(-r, "Failed to get string: %m"); + log_error_errno(r, "Failed to get string: %m"); goto finish; } @@ -322,7 +322,7 @@ static void* client1(void*p) { "h", pp[1]); if (r < 0) { - log_error_errno(-r, "Failed to issue method call: %m"); + log_error_errno(r, "Failed to issue method call: %m"); goto finish; } @@ -346,7 +346,7 @@ finish: "org.freedesktop.systemd.test", "ExitClient1"); if (r < 0) - log_error_errno(-r, "Failed to allocate method call: %m"); + log_error_errno(r, "Failed to allocate method call: %m"); else sd_bus_send(bus, q, NULL); @@ -380,7 +380,7 @@ static void* client2(void*p) { r = sd_bus_open_user(&bus); if (r < 0) { - log_error_errno(-r, "Failed to connect to user bus: %m"); + log_error_errno(r, "Failed to connect to user bus: %m"); goto finish; } @@ -392,7 +392,7 @@ static void* client2(void*p) { "org.object.test", "Foobar"); if (r < 0) { - log_error_errno(-r, "Failed to allocate method call: %m"); + log_error_errno(r, "Failed to allocate method call: %m"); goto finish; } @@ -412,7 +412,7 @@ static void* client2(void*p) { "foo.bar", "Notify"); if (r < 0) { - log_error_errno(-r, "Failed to allocate signal: %m"); + log_error_errno(r, "Failed to allocate signal: %m"); goto finish; } @@ -433,7 +433,7 @@ static void* client2(void*p) { "org.freedesktop.DBus.Peer", "GetMachineId"); if (r < 0) { - log_error_errno(-r, "Failed to allocate method call: %m"); + log_error_errno(r, "Failed to allocate method call: %m"); goto finish; } @@ -445,7 +445,7 @@ static void* client2(void*p) { r = sd_bus_message_read(reply, "s", &mid); if (r < 0) { - log_error_errno(-r, "Failed to parse machine ID: %m"); + log_error_errno(r, "Failed to parse machine ID: %m"); goto finish; } @@ -462,7 +462,7 @@ static void* client2(void*p) { "org.freedesktop.systemd.test", "Slow"); if (r < 0) { - log_error_errno(-r, "Failed to allocate method call: %m"); + log_error_errno(r, "Failed to allocate method call: %m"); goto finish; } @@ -486,7 +486,7 @@ static void* client2(void*p) { "org.freedesktop.systemd.test", "Slow"); if (r < 0) { - log_error_errno(-r, "Failed to allocate method call: %m"); + log_error_errno(r, "Failed to allocate method call: %m"); goto finish; } @@ -499,13 +499,13 @@ static void* client2(void*p) { while (!quit) { r = sd_bus_process(bus, NULL); if (r < 0) { - log_error_errno(-r, "Failed to process requests: %m"); + log_error_errno(r, "Failed to process requests: %m"); goto finish; } if (r == 0) { r = sd_bus_wait(bus, (uint64_t) -1); if (r < 0) { - log_error_errno(-r, "Failed to wait: %m"); + log_error_errno(r, "Failed to wait: %m"); goto finish; } } @@ -525,7 +525,7 @@ finish: "org.freedesktop.systemd.test", "ExitClient2"); if (r < 0) { - log_error_errno(-r, "Failed to allocate method call: %m"); + log_error_errno(r, "Failed to allocate method call: %m"); goto finish; } diff --git a/src/libsystemd/sd-bus/test-bus-objects.c b/src/libsystemd/sd-bus/test-bus-objects.c index 2ed34e5120..06b8904f13 100644 --- a/src/libsystemd/sd-bus/test-bus-objects.c +++ b/src/libsystemd/sd-bus/test-bus-objects.c @@ -237,14 +237,14 @@ static void *server(void *p) { r = sd_bus_process(bus, NULL); if (r < 0) { - log_error_errno(-r, "Failed to process requests: %m"); + log_error_errno(r, "Failed to process requests: %m"); goto fail; } if (r == 0) { r = sd_bus_wait(bus, (uint64_t) -1); if (r < 0) { - log_error_errno(-r, "Failed to wait: %m"); + log_error_errno(r, "Failed to wait: %m"); goto fail; } diff --git a/src/libsystemd/sd-bus/test-bus-server.c b/src/libsystemd/sd-bus/test-bus-server.c index 30e2d8cf44..e65811f047 100644 --- a/src/libsystemd/sd-bus/test-bus-server.c +++ b/src/libsystemd/sd-bus/test-bus-server.c @@ -65,14 +65,14 @@ static void *server(void *p) { r = sd_bus_process(bus, &m); if (r < 0) { - log_error_errno(-r, "Failed to process requests: %m"); + log_error_errno(r, "Failed to process requests: %m"); goto fail; } if (r == 0) { r = sd_bus_wait(bus, (uint64_t) -1); if (r < 0) { - log_error_errno(-r, "Failed to wait: %m"); + log_error_errno(r, "Failed to wait: %m"); goto fail; } @@ -90,7 +90,7 @@ static void *server(void *p) { r = sd_bus_message_new_method_return(m, &reply); if (r < 0) { - log_error_errno(-r, "Failed to allocate return: %m"); + log_error_errno(r, "Failed to allocate return: %m"); goto fail; } @@ -102,7 +102,7 @@ static void *server(void *p) { &reply, &SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_UNKNOWN_METHOD, "Unknown method.")); if (r < 0) { - log_error_errno(-r, "Failed to allocate return: %m"); + log_error_errno(r, "Failed to allocate return: %m"); goto fail; } } @@ -110,7 +110,7 @@ static void *server(void *p) { if (reply) { r = sd_bus_send(bus, reply, NULL); if (r < 0) { - log_error_errno(-r, "Failed to send reply: %m"); + log_error_errno(r, "Failed to send reply: %m"); goto fail; } } @@ -147,7 +147,7 @@ static int client(struct context *c) { "org.freedesktop.systemd.test", "Exit"); if (r < 0) { - log_error_errno(-r, "Failed to allocate method call: %m"); + log_error_errno(r, "Failed to allocate method call: %m"); return r; } diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c index 993ef202de..f9fa54d2e8 100644 --- a/src/libsystemd/sd-event/sd-event.c +++ b/src/libsystemd/sd-event/sd-event.c @@ -2158,9 +2158,9 @@ static int source_dispatch(sd_event_source *s) { if (r < 0) { if (s->description) - log_debug_errno(-r, "Event source '%s' returned error, disabling: %m", s->description); + log_debug_errno(r, "Event source '%s' returned error, disabling: %m", s->description); else - log_debug_errno(-r, "Event source %p returned error, disabling: %m", s); + log_debug_errno(r, "Event source %p returned error, disabling: %m", s); } if (s->n_ref == 0) @@ -2196,9 +2196,9 @@ static int event_prepare(sd_event *e) { if (r < 0) { if (s->description) - log_debug_errno(-r, "Prepare callback of event source '%s' returned error, disabling: %m", s->description); + log_debug_errno(r, "Prepare callback of event source '%s' returned error, disabling: %m", s->description); else - log_debug_errno(-r, "Prepare callback of event source %p returned error, disabling: %m", s); + log_debug_errno(r, "Prepare callback of event source %p returned error, disabling: %m", s); } if (s->n_ref == 0) diff --git a/src/libsystemd/sd-rtnl/rtnl-util.c b/src/libsystemd/sd-rtnl/rtnl-util.c index 1adfbb8643..bd97ba9ae7 100644 --- a/src/libsystemd/sd-rtnl/rtnl-util.c +++ b/src/libsystemd/sd-rtnl/rtnl-util.c @@ -157,11 +157,11 @@ bool rtnl_message_type_is_addr(uint16_t type) { } int rtnl_log_parse_error(int r) { - log_error_errno(-r, "Failed to parse netlink message: %m"); + log_error_errno(r, "Failed to parse netlink message: %m"); return r; } int rtnl_log_create_error(int r) { - log_error_errno(-r, "Failed to create netlink message: %m"); + log_error_errno(r, "Failed to create netlink message: %m"); return r; } diff --git a/src/libsystemd/sd-rtnl/test-rtnl.c b/src/libsystemd/sd-rtnl/test-rtnl.c index d77bce45cc..72d8fe2273 100644 --- a/src/libsystemd/sd-rtnl/test-rtnl.c +++ b/src/libsystemd/sd-rtnl/test-rtnl.c @@ -135,7 +135,7 @@ static void test_route(void) { r = sd_rtnl_message_new_route(NULL, &req, RTM_NEWROUTE, AF_INET, RTPROT_STATIC); if (r < 0) { - log_error_errno(-r, "Could not create RTM_NEWROUTE message: %m"); + log_error_errno(r, "Could not create RTM_NEWROUTE message: %m"); return; } @@ -143,13 +143,13 @@ static void test_route(void) { r = sd_rtnl_message_append_in_addr(req, RTA_GATEWAY, &addr); if (r < 0) { - log_error_errno(-r, "Could not append RTA_GATEWAY attribute: %m"); + log_error_errno(r, "Could not append RTA_GATEWAY attribute: %m"); return; } r = sd_rtnl_message_append_u32(req, RTA_OIF, index); if (r < 0) { - log_error_errno(-r, "Could not append RTA_OIF attribute: %m"); + log_error_errno(r, "Could not append RTA_OIF attribute: %m"); return; } @@ -223,7 +223,7 @@ static int pipe_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) { r = sd_rtnl_message_get_errno(m); - log_info_errno(-r, "%d left in pipe. got reply: %m", *counter); + log_info_errno(r, "%d left in pipe. got reply: %m", *counter); assert_se(r >= 0); diff --git a/src/locale/localectl.c b/src/locale/localectl.c index 70f3b56558..333b458471 100644 --- a/src/locale/localectl.c +++ b/src/locale/localectl.c @@ -110,7 +110,7 @@ static void print_overriden_variables(void) { NULL); if (r < 0 && r != -ENOENT) { - log_warning_errno(-r, "Failed to read /proc/cmdline: %m"); + log_warning_errno(r, "Failed to read /proc/cmdline: %m"); goto finish; } @@ -178,7 +178,7 @@ static int show_status(sd_bus *bus, char **args, unsigned n) { map, &info); if (r < 0) { - log_error_errno(-r, "Could not get properties: %m"); + log_error_errno(r, "Could not get properties: %m"); goto fail; } @@ -235,7 +235,7 @@ static int list_locales(sd_bus *bus, char **args, unsigned n) { r = get_locales(&l); if (r < 0) { - log_error_errno(-r, "Failed to read list of locales: %m"); + log_error_errno(r, "Failed to read list of locales: %m"); return r; } @@ -310,7 +310,7 @@ static int nftw_cb( r = set_consume(keymaps, p); if (r < 0 && r != -EEXIST) { - log_error_errno(-r, "Can't add keymap: %m"); + log_error_errno(r, "Can't add keymap: %m"); return r; } @@ -683,7 +683,7 @@ int main(int argc, char*argv[]) { r = bus_open_transport(arg_transport, arg_host, false, &bus); if (r < 0) { - log_error_errno(-r, "Failed to create bus connection: %m"); + log_error_errno(r, "Failed to create bus connection: %m"); goto finish; } diff --git a/src/locale/localed.c b/src/locale/localed.c index 2a293a7bc0..f587b224a0 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c @@ -375,7 +375,7 @@ static int locale_update_system_manager(Context *c, sd_bus *bus) { r = sd_bus_call(bus, m, 0, &error, NULL); if (r < 0) - log_error_errno(-r, "Failed to update the manager environment: %m"); + log_error_errno(r, "Failed to update the manager environment: %m"); return 0; } @@ -611,7 +611,7 @@ static int vconsole_convert_to_x11(Context *c, sd_bus *bus) { r = x11_write_data(c); if (r < 0) { - log_error_errno(-r, "Failed to set X11 keyboard layout: %m"); + log_error_errno(r, "Failed to set X11 keyboard layout: %m"); return r; } @@ -790,7 +790,7 @@ static int x11_convert_to_vconsole(Context *c, sd_bus *bus) { if (modified) { r = vconsole_write_data(c); if (r < 0) - log_error_errno(-r, "Failed to set virtual console keymap: %m"); + log_error_errno(r, "Failed to set virtual console keymap: %m"); log_info("Changed virtual console keymap to '%s' toggle '%s'", strempty(c->vc_keymap), strempty(c->vc_keymap_toggle)); @@ -923,7 +923,7 @@ static int method_set_locale(sd_bus *bus, sd_bus_message *m, void *userdata, sd_ r = locale_write_data(c, &settings); if (r < 0) { - log_error_errno(-r, "Failed to set locale: %m"); + log_error_errno(r, "Failed to set locale: %m"); return sd_bus_error_set_errnof(error, r, "Failed to set locale: %s", strerror(-r)); } @@ -983,7 +983,7 @@ static int method_set_vc_keyboard(sd_bus *bus, sd_bus_message *m, void *userdata r = vconsole_write_data(c); if (r < 0) { - log_error_errno(-r, "Failed to set virtual console keymap: %m"); + log_error_errno(r, "Failed to set virtual console keymap: %m"); return sd_bus_error_set_errnof(error, r, "Failed to set virtual console keymap: %s", strerror(-r)); } @@ -992,7 +992,7 @@ static int method_set_vc_keyboard(sd_bus *bus, sd_bus_message *m, void *userdata r = vconsole_reload(bus); if (r < 0) - log_error_errno(-r, "Failed to request keymap reload: %m"); + log_error_errno(r, "Failed to request keymap reload: %m"); sd_bus_emit_properties_changed(bus, "/org/freedesktop/locale1", @@ -1002,7 +1002,7 @@ static int method_set_vc_keyboard(sd_bus *bus, sd_bus_message *m, void *userdata if (convert) { r = vconsole_convert_to_x11(c, bus); if (r < 0) - log_error_errno(-r, "Failed to convert keymap data: %m"); + log_error_errno(r, "Failed to convert keymap data: %m"); } } @@ -1106,7 +1106,7 @@ static int method_set_x11_keyboard(sd_bus *bus, sd_bus_message *m, void *userdat r = x11_write_data(c); if (r < 0) { - log_error_errno(-r, "Failed to set X11 keyboard layout: %m"); + log_error_errno(r, "Failed to set X11 keyboard layout: %m"); return sd_bus_error_set_errnof(error, r, "Failed to set X11 keyboard layout: %s", strerror(-r)); } @@ -1124,7 +1124,7 @@ static int method_set_x11_keyboard(sd_bus *bus, sd_bus_message *m, void *userdat if (convert) { r = x11_convert_to_vconsole(c, bus); if (r < 0) - log_error_errno(-r, "Failed to convert keymap data: %m"); + log_error_errno(r, "Failed to convert keymap data: %m"); } } @@ -1156,25 +1156,25 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) { r = sd_bus_default_system(&bus); if (r < 0) { - log_error_errno(-r, "Failed to get system bus connection: %m"); + log_error_errno(r, "Failed to get system bus connection: %m"); return r; } r = sd_bus_add_object_vtable(bus, NULL, "/org/freedesktop/locale1", "org.freedesktop.locale1", locale_vtable, c); if (r < 0) { - log_error_errno(-r, "Failed to register object: %m"); + log_error_errno(r, "Failed to register object: %m"); return r; } r = sd_bus_request_name(bus, "org.freedesktop.locale1", 0); if (r < 0) { - log_error_errno(-r, "Failed to register name: %m"); + log_error_errno(r, "Failed to register name: %m"); return r; } r = sd_bus_attach_event(bus, event, 0); if (r < 0) { - log_error_errno(-r, "Failed to attach bus to event loop: %m"); + log_error_errno(r, "Failed to attach bus to event loop: %m"); return r; } @@ -1205,7 +1205,7 @@ int main(int argc, char *argv[]) { r = sd_event_default(&event); if (r < 0) { - log_error_errno(-r, "Failed to allocate event loop: %m"); + log_error_errno(r, "Failed to allocate event loop: %m"); goto finish; } @@ -1217,13 +1217,13 @@ int main(int argc, char *argv[]) { r = context_read_data(&context); if (r < 0) { - log_error_errno(-r, "Failed to read locale data: %m"); + log_error_errno(r, "Failed to read locale data: %m"); goto finish; } r = bus_event_loop_with_idle(event, bus, "org.freedesktop.locale1", DEFAULT_EXIT_USEC, NULL, NULL); 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/login/inhibit.c b/src/login/inhibit.c index 3034e20f0e..db977ccc59 100644 --- a/src/login/inhibit.c +++ b/src/login/inhibit.c @@ -235,7 +235,7 @@ int main(int argc, char *argv[]) { r = sd_bus_default_system(&bus); if (r < 0) { - log_error_errno(-r, "Failed to connect to bus: %m"); + log_error_errno(r, "Failed to connect to bus: %m"); return EXIT_FAILURE; } diff --git a/src/login/loginctl.c b/src/login/loginctl.c index d0fd14b90d..80e03ebbec 100644 --- a/src/login/loginctl.c +++ b/src/login/loginctl.c @@ -385,7 +385,7 @@ static int print_session_status_info(sd_bus *bus, const char *path, bool *new_li r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i); if (r < 0) { - log_error_errno(-r, "Could not get properties: %m"); + log_error_errno(r, "Could not get properties: %m"); return r; } @@ -498,7 +498,7 @@ static int print_user_status_info(sd_bus *bus, const char *path, bool *new_line) r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i); if (r < 0) { - log_error_errno(-r, "Could not get properties: %m"); + log_error_errno(r, "Could not get properties: %m"); goto finish; } @@ -562,7 +562,7 @@ static int print_seat_status_info(sd_bus *bus, const char *path, bool *new_line) r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i); if (r < 0) { - log_error_errno(-r, "Could not get properties: %m"); + log_error_errno(r, "Could not get properties: %m"); goto finish; } @@ -617,7 +617,7 @@ static int show_properties(sd_bus *bus, const char *path, bool *new_line) { r = bus_print_all_properties(bus, "org.freedesktop.login1", path, arg_property, arg_all); if (r < 0) - log_error_errno(-r, "Could not get properties: %m"); + log_error_errno(r, "Could not get properties: %m"); return r; } @@ -700,7 +700,7 @@ static int show_user(sd_bus *bus, char **args, unsigned n) { r = get_user_creds((const char**) (args+i), &uid, NULL, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Failed to look up user %s: %m", args[i]); + log_error_errno(r, "Failed to look up user %s: %m", args[i]); return r; } @@ -860,7 +860,7 @@ static int enable_linger(sd_bus *bus, char **args, unsigned n) { r = get_user_creds((const char**) (args+i), &uid, NULL, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Failed to look up user %s: %m", args[i]); + log_error_errno(r, "Failed to look up user %s: %m", args[i]); return r; } @@ -893,7 +893,7 @@ static int terminate_user(sd_bus *bus, char **args, unsigned n) { r = get_user_creds((const char**) (args+i), &uid, NULL, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Failed to look up user %s: %m", args[i]); + log_error_errno(r, "Failed to look up user %s: %m", args[i]); return r; } @@ -929,7 +929,7 @@ static int kill_user(sd_bus *bus, char **args, unsigned n) { r = get_user_creds((const char**) (args+i), &uid, NULL, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Failed to look up user %s: %m", args[i]); + log_error_errno(r, "Failed to look up user %s: %m", args[i]); return r; } @@ -1308,7 +1308,7 @@ int main(int argc, char *argv[]) { r = bus_open_transport(arg_transport, arg_host, false, &bus); if (r < 0) { - log_error_errno(-r, "Failed to create bus connection: %m"); + log_error_errno(r, "Failed to create bus connection: %m"); goto finish; } diff --git a/src/login/logind-button.c b/src/login/logind-button.c index d2cc430845..9c0c6302a9 100644 --- a/src/login/logind-button.c +++ b/src/login/logind-button.c @@ -263,7 +263,7 @@ int button_open(Button *b) { r = sd_event_add_io(b->manager->event, &b->io_event_source, b->fd, EPOLLIN, button_dispatch, b); if (r < 0) { - log_error_errno(-r, "Failed to add button event: %m"); + log_error_errno(r, "Failed to add button event: %m"); goto fail; } diff --git a/src/login/logind-core.c b/src/login/logind-core.c index 0f4ac9fb81..88694f9bac 100644 --- a/src/login/logind-core.c +++ b/src/login/logind-core.c @@ -551,7 +551,7 @@ bool manager_is_docked_or_multiple_displays(Manager *m) { * assume that we are docked. */ n = manager_count_displays(m); if (n < 0) - log_warning_errno(-n, "Display counting failed: %m"); + log_warning_errno(n, "Display counting failed: %m"); else if (n > 1) { log_debug("Multiple (%i) displays connected.", n); return true; diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c index 198e7df78c..84fee0e773 100644 --- a/src/login/logind-inhibit.c +++ b/src/login/logind-inhibit.c @@ -138,7 +138,7 @@ int inhibitor_save(Inhibitor *i) { finish: if (r < 0) - log_error_errno(-r, "Failed to save inhibit data %s: %m", i->state_file); + log_error_errno(r, "Failed to save inhibit data %s: %m", i->state_file); return r; } diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c index 04909a991a..8eb5e3ee0a 100644 --- a/src/login/logind-seat.c +++ b/src/login/logind-seat.c @@ -154,7 +154,7 @@ int seat_save(Seat *s) { finish: if (r < 0) - log_error_errno(-r, "Failed to save seat data %s: %m", s->state_file); + log_error_errno(r, "Failed to save seat data %s: %m", s->state_file); return r; } @@ -201,7 +201,7 @@ int seat_preallocate_vts(Seat *s) { q = vt_allocate(i); if (q < 0) { - log_error_errno(-q, "Failed to preallocate VT %i: %m", i); + log_error_errno(q, "Failed to preallocate VT %i: %m", i); r = q; } } @@ -221,7 +221,7 @@ int seat_apply_acls(Seat *s, Session *old_active) { !!s->active, s->active ? s->active->user->uid : 0); if (r < 0) - log_error_errno(-r, "Failed to apply ACLs: %m"); + log_error_errno(r, "Failed to apply ACLs: %m"); return r; } diff --git a/src/login/logind-session.c b/src/login/logind-session.c index 1cbb64c438..20161ede9d 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -292,7 +292,7 @@ int session_save(Session *s) { finish: if (r < 0) - log_error_errno(-r, "Failed to save session data %s: %m", s->state_file); + log_error_errno(r, "Failed to save session data %s: %m", s->state_file); return r; } @@ -338,7 +338,7 @@ int session_load(Session *s) { NULL); if (r < 0) { - log_error_errno(-r, "Failed to read %s: %m", s->state_file); + log_error_errno(r, "Failed to read %s: %m", s->state_file); return r; } diff --git a/src/login/logind-user.c b/src/login/logind-user.c index 7a39140d88..d2a4f7e9cb 100644 --- a/src/login/logind-user.c +++ b/src/login/logind-user.c @@ -252,7 +252,7 @@ int user_save(User *u) { finish: if (r < 0) - log_error_errno(-r, "Failed to save user data %s: %m", u->state_file); + log_error_errno(r, "Failed to save user data %s: %m", u->state_file); return r; } @@ -278,7 +278,7 @@ int user_load(User *u) { if (r == -ENOENT) return 0; - log_error_errno(-r, "Failed to read %s: %m", u->state_file); + log_error_errno(r, "Failed to read %s: %m", u->state_file); return r; } @@ -311,7 +311,7 @@ static int user_mkdir_runtime_path(User *u) { r = mkdir_safe_label("/run/user", 0755, 0, 0); if (r < 0) { - log_error_errno(-r, "Failed to create /run/user: %m"); + log_error_errno(r, "Failed to create /run/user: %m"); return r; } @@ -338,7 +338,7 @@ static int user_mkdir_runtime_path(User *u) { r = mount("tmpfs", p, "tmpfs", MS_NODEV|MS_NOSUID, t); if (r < 0) { - log_error_errno(-r, "Failed to mount per-user tmpfs directory %s: %m", p); + log_error_errno(r, "Failed to mount per-user tmpfs directory %s: %m", p); goto fail; } } @@ -510,14 +510,14 @@ static int user_remove_runtime_path(User *u) { r = rm_rf(u->runtime_path, false, false, false); if (r < 0) - log_error_errno(-r, "Failed to remove runtime directory %s: %m", u->runtime_path); + log_error_errno(r, "Failed to remove runtime directory %s: %m", u->runtime_path); if (umount2(u->runtime_path, MNT_DETACH) < 0) log_error("Failed to unmount user runtime directory %s: %m", u->runtime_path); r = rm_rf(u->runtime_path, false, true, false); if (r < 0) - log_error_errno(-r, "Failed to remove runtime directory %s: %m", u->runtime_path); + log_error_errno(r, "Failed to remove runtime directory %s: %m", u->runtime_path); free(u->runtime_path); u->runtime_path = NULL; diff --git a/src/login/logind.c b/src/login/logind.c index 63e07ad9a3..d7fb1bf170 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -339,7 +339,7 @@ static int manager_enumerate_linger_users(Manager *m) { k = manager_add_user_by_name(m, de->d_name, NULL); if (k < 0) { - log_notice_errno(-k, "Couldn't add lingering user %s: %m", de->d_name); + log_notice_errno(k, "Couldn't add lingering user %s: %m", de->d_name); r = k; } } @@ -375,7 +375,7 @@ static int manager_enumerate_users(Manager *m) { k = manager_add_user_by_name(m, de->d_name, &u); if (k < 0) { - log_error_errno(-k, "Failed to add user by file name %s: %m", de->d_name); + log_error_errno(k, "Failed to add user by file name %s: %m", de->d_name); r = k; continue; @@ -423,7 +423,7 @@ static int manager_enumerate_sessions(Manager *m) { k = manager_add_session(m, de->d_name, &s); if (k < 0) { - log_error_errno(-k, "Failed to add session by file name %s: %m", de->d_name); + log_error_errno(k, "Failed to add session by file name %s: %m", de->d_name); r = k; continue; @@ -464,7 +464,7 @@ static int manager_enumerate_inhibitors(Manager *m) { k = manager_add_inhibitor(m, de->d_name, &i); if (k < 0) { - log_notice_errno(-k, "Couldn't add inhibitor %s: %m", de->d_name); + log_notice_errno(k, "Couldn't add inhibitor %s: %m", de->d_name); r = k; continue; } @@ -584,49 +584,49 @@ static int manager_connect_bus(Manager *m) { r = sd_bus_default_system(&m->bus); if (r < 0) { - log_error_errno(-r, "Failed to connect to system bus: %m"); + log_error_errno(r, "Failed to connect to system bus: %m"); return r; } r = sd_bus_add_object_vtable(m->bus, NULL, "/org/freedesktop/login1", "org.freedesktop.login1.Manager", manager_vtable, m); if (r < 0) { - log_error_errno(-r, "Failed to add manager object vtable: %m"); + log_error_errno(r, "Failed to add manager object vtable: %m"); return r; } r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/login1/seat", "org.freedesktop.login1.Seat", seat_vtable, seat_object_find, m); if (r < 0) { - log_error_errno(-r, "Failed to add seat object vtable: %m"); + log_error_errno(r, "Failed to add seat object vtable: %m"); return r; } r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/login1/seat", seat_node_enumerator, m); if (r < 0) { - log_error_errno(-r, "Failed to add seat enumerator: %m"); + log_error_errno(r, "Failed to add seat enumerator: %m"); return r; } r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/login1/session", "org.freedesktop.login1.Session", session_vtable, session_object_find, m); if (r < 0) { - log_error_errno(-r, "Failed to add session object vtable: %m"); + log_error_errno(r, "Failed to add session object vtable: %m"); return r; } r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/login1/session", session_node_enumerator, m); if (r < 0) { - log_error_errno(-r, "Failed to add session enumerator: %m"); + log_error_errno(r, "Failed to add session enumerator: %m"); return r; } r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/login1/user", "org.freedesktop.login1.User", user_vtable, user_object_find, m); if (r < 0) { - log_error_errno(-r, "Failed to add user object vtable: %m"); + log_error_errno(r, "Failed to add user object vtable: %m"); return r; } r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/login1/user", user_node_enumerator, m); if (r < 0) { - log_error_errno(-r, "Failed to add user enumerator: %m"); + log_error_errno(r, "Failed to add user enumerator: %m"); return r; } @@ -639,7 +639,7 @@ static int manager_connect_bus(Manager *m) { "path='/org/freedesktop/DBus'", match_name_owner_changed, m); if (r < 0) { - log_error_errno(-r, "Failed to add match for NameOwnerChanged: %m"); + log_error_errno(r, "Failed to add match for NameOwnerChanged: %m"); return r; } @@ -652,7 +652,7 @@ static int manager_connect_bus(Manager *m) { "path='/org/freedesktop/systemd1'", match_job_removed, m); if (r < 0) { - log_error_errno(-r, "Failed to add match for JobRemoved: %m"); + log_error_errno(r, "Failed to add match for JobRemoved: %m"); return r; } @@ -665,7 +665,7 @@ static int manager_connect_bus(Manager *m) { "path='/org/freedesktop/systemd1'", match_unit_removed, m); if (r < 0) { - log_error_errno(-r, "Failed to add match for UnitRemoved: %m"); + log_error_errno(r, "Failed to add match for UnitRemoved: %m"); return r; } @@ -677,7 +677,7 @@ static int manager_connect_bus(Manager *m) { "member='PropertiesChanged'", match_properties_changed, m); if (r < 0) { - log_error_errno(-r, "Failed to add match for PropertiesChanged: %m"); + log_error_errno(r, "Failed to add match for PropertiesChanged: %m"); return r; } @@ -690,7 +690,7 @@ static int manager_connect_bus(Manager *m) { "path='/org/freedesktop/systemd1'", match_reloading, m); if (r < 0) { - log_error_errno(-r, "Failed to add match for Reloading: %m"); + log_error_errno(r, "Failed to add match for Reloading: %m"); return r; } @@ -709,13 +709,13 @@ static int manager_connect_bus(Manager *m) { r = sd_bus_request_name(m->bus, "org.freedesktop.login1", 0); if (r < 0) { - log_error_errno(-r, "Failed to register name: %m"); + log_error_errno(r, "Failed to register name: %m"); return r; } r = sd_bus_attach_event(m->bus, m->event, 0); if (r < 0) { - log_error_errno(-r, "Failed to attach bus to event loop: %m"); + log_error_errno(r, "Failed to attach bus to event loop: %m"); return r; } @@ -807,13 +807,13 @@ static int manager_connect_console(Manager *m) { r = ignore_signals(SIGRTMIN + 1, -1); if (r < 0) { - log_error_errno(-r, "Cannot ignore SIGRTMIN + 1: %m"); + log_error_errno(r, "Cannot ignore SIGRTMIN + 1: %m"); return r; } r = sigprocmask_many(SIG_BLOCK, SIGRTMIN, -1); if (r < 0) { - log_error_errno(-r, "Cannot block SIGRTMIN: %m"); + log_error_errno(r, "Cannot block SIGRTMIN: %m"); return r; } @@ -1017,25 +1017,25 @@ static int manager_dispatch_idle_action(sd_event_source *s, uint64_t t, void *us elapse, USEC_PER_SEC*30, manager_dispatch_idle_action, m); if (r < 0) { - log_error_errno(-r, "Failed to add idle event source: %m"); + log_error_errno(r, "Failed to add idle event source: %m"); return r; } r = sd_event_source_set_priority(m->idle_action_event_source, SD_EVENT_PRIORITY_IDLE+10); if (r < 0) { - log_error_errno(-r, "Failed to set idle event source priority: %m"); + log_error_errno(r, "Failed to set idle event source priority: %m"); return r; } } else { r = sd_event_source_set_time(m->idle_action_event_source, elapse); if (r < 0) { - log_error_errno(-r, "Failed to set idle event timer: %m"); + log_error_errno(r, "Failed to set idle event timer: %m"); return r; } r = sd_event_source_set_enabled(m->idle_action_event_source, SD_EVENT_ONESHOT); if (r < 0) { - log_error_errno(-r, "Failed to enable idle event timer: %m"); + log_error_errno(r, "Failed to enable idle event timer: %m"); return r; } } @@ -1062,7 +1062,7 @@ int manager_startup(Manager *m) { /* Connect to udev */ r = manager_connect_udev(m); if (r < 0) { - log_error_errno(-r, "Failed to create udev watchers: %m"); + log_error_errno(r, "Failed to create udev watchers: %m"); return r; } @@ -1074,38 +1074,38 @@ int manager_startup(Manager *m) { /* Instantiate magic seat 0 */ r = manager_add_seat(m, "seat0", &m->seat0); if (r < 0) { - log_error_errno(-r, "Failed to add seat0: %m"); + log_error_errno(r, "Failed to add seat0: %m"); return r; } r = manager_set_lid_switch_ignore(m, 0 + IGNORE_LID_SWITCH_STARTUP_USEC); if (r < 0) - log_warning_errno(-r, "Failed to set up lid switch ignore event source: %m"); + log_warning_errno(r, "Failed to set up lid switch ignore event source: %m"); /* Deserialize state */ r = manager_enumerate_devices(m); if (r < 0) - log_warning_errno(-r, "Device enumeration failed: %m"); + log_warning_errno(r, "Device enumeration failed: %m"); r = manager_enumerate_seats(m); if (r < 0) - log_warning_errno(-r, "Seat enumeration failed: %m"); + log_warning_errno(r, "Seat enumeration failed: %m"); r = manager_enumerate_users(m); if (r < 0) - log_warning_errno(-r, "User enumeration failed: %m"); + log_warning_errno(r, "User enumeration failed: %m"); r = manager_enumerate_sessions(m); if (r < 0) - log_warning_errno(-r, "Session enumeration failed: %m"); + log_warning_errno(r, "Session enumeration failed: %m"); r = manager_enumerate_inhibitors(m); if (r < 0) - log_warning_errno(-r, "Inhibitor enumeration failed: %m"); + log_warning_errno(r, "Inhibitor enumeration failed: %m"); r = manager_enumerate_buttons(m); if (r < 0) - log_warning_errno(-r, "Button enumeration failed: %m"); + log_warning_errno(r, "Button enumeration failed: %m"); /* Remove stale objects before we start them */ manager_gc(m, false); @@ -1214,7 +1214,7 @@ int main(int argc, char *argv[]) { r = manager_startup(m); if (r < 0) { - log_error_errno(-r, "Failed to fully start up daemon: %m"); + log_error_errno(r, "Failed to fully start up daemon: %m"); goto finish; } diff --git a/src/login/user-sessions.c b/src/login/user-sessions.c index 3639a1836b..fb0afc5e50 100644 --- a/src/login/user-sessions.c +++ b/src/login/user-sessions.c @@ -68,7 +68,7 @@ int main(int argc, char*argv[]) { r = write_string_file_atomic("/run/nologin", "System is going down."); if (r < 0) { - log_error_errno(-r, "Failed to create /run/nologin: %m"); + log_error_errno(r, "Failed to create /run/nologin: %m"); return EXIT_FAILURE; } diff --git a/src/machine/machine.c b/src/machine/machine.c index 88c10b7315..40189269e0 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -216,7 +216,7 @@ finish: if (temp_path) unlink(temp_path); - log_error_errno(-r, "Failed to save machine data %s: %m", m->state_file); + log_error_errno(r, "Failed to save machine data %s: %m", m->state_file); } return r; @@ -259,7 +259,7 @@ int machine_load(Machine *m) { if (r == -ENOENT) return 0; - log_error_errno(-r, "Failed to read %s: %m", m->state_file); + log_error_errno(r, "Failed to read %s: %m", m->state_file); return r; } diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index 7ef6244c62..52cdfda627 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -415,7 +415,7 @@ static int show_info(const char *verb, sd_bus *bus, const char *path, bool *new_ map, &info); if (r < 0) { - log_error_errno(-r, "Could not get properties: %m"); + log_error_errno(r, "Could not get properties: %m"); return r; } @@ -445,7 +445,7 @@ static int show_properties(sd_bus *bus, const char *path, bool *new_line) { r = bus_print_all_properties(bus, "org.freedesktop.machine1", path, arg_property, arg_all); if (r < 0) - log_error_errno(-r, "Could not get properties: %m"); + log_error_errno(r, "Could not get properties: %m"); return r; } @@ -682,13 +682,13 @@ static int login_machine(sd_bus *bus, char **args, unsigned n) { r = sd_event_default(&event); if (r < 0) { - log_error_errno(-r, "Failed to get event loop: %m"); + log_error_errno(r, "Failed to get event loop: %m"); return r; } r = sd_bus_attach_event(bus, event, 0); if (r < 0) { - log_error_errno(-r, "Failed to attach bus to event loop: %m"); + log_error_errno(r, "Failed to attach bus to event loop: %m"); return r; } @@ -720,7 +720,7 @@ static int login_machine(sd_bus *bus, char **args, unsigned n) { &reply2, "u"); if (r < 0) { - log_error_errno(-r, "Failed to retrieve PID of leader: %m"); + log_error_errno(r, "Failed to retrieve PID of leader: %m"); return r; } @@ -730,7 +730,7 @@ static int login_machine(sd_bus *bus, char **args, unsigned n) { master = openpt_in_namespace(leader, O_RDWR|O_NOCTTY|O_CLOEXEC|O_NDELAY); if (master < 0) { - log_error_errno(-master, "Failed to acquire pseudo tty: %m"); + log_error_errno(master, "Failed to acquire pseudo tty: %m"); return master; } @@ -748,7 +748,7 @@ static int login_machine(sd_bus *bus, char **args, unsigned n) { r = sd_bus_open_system_container(&container_bus, args[1]); if (r < 0) { - log_error_errno(-r, "Failed to get container bus: %m"); + log_error_errno(r, "Failed to get container bus: %m"); return r; } @@ -786,13 +786,13 @@ static int login_machine(sd_bus *bus, char **args, unsigned n) { r = pty_forward_new(event, master, &forward); if (r < 0) { - log_error_errno(-r, "Failed to create PTY forwarder: %m"); + log_error_errno(r, "Failed to create PTY forwarder: %m"); return r; } r = sd_event_loop(event); if (r < 0) { - log_error_errno(-r, "Failed to run event loop: %m"); + log_error_errno(r, "Failed to run event loop: %m"); return r; } @@ -1029,7 +1029,7 @@ int main(int argc, char*argv[]) { r = bus_open_transport(arg_transport, arg_host, false, &bus); if (r < 0) { - log_error_errno(-r, "Failed to create bus connection: %m"); + log_error_errno(r, "Failed to create bus connection: %m"); goto finish; } diff --git a/src/machine/machined.c b/src/machine/machined.c index 7f03e8281d..2385fead6e 100644 --- a/src/machine/machined.c +++ b/src/machine/machined.c @@ -113,7 +113,7 @@ int manager_enumerate_machines(Manager *m) { k = manager_add_machine(m, de->d_name, &machine); if (k < 0) { - log_error_errno(-k, "Failed to add machine by file name %s: %m", de->d_name); + log_error_errno(k, "Failed to add machine by file name %s: %m", de->d_name); r = k; continue; @@ -138,25 +138,25 @@ static int manager_connect_bus(Manager *m) { r = sd_bus_default_system(&m->bus); if (r < 0) { - log_error_errno(-r, "Failed to connect to system bus: %m"); + log_error_errno(r, "Failed to connect to system bus: %m"); return r; } r = sd_bus_add_object_vtable(m->bus, NULL, "/org/freedesktop/machine1", "org.freedesktop.machine1.Manager", manager_vtable, m); if (r < 0) { - log_error_errno(-r, "Failed to add manager object vtable: %m"); + log_error_errno(r, "Failed to add manager object vtable: %m"); return r; } r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/machine1/machine", "org.freedesktop.machine1.Machine", machine_vtable, machine_object_find, m); if (r < 0) { - log_error_errno(-r, "Failed to add machine object vtable: %m"); + log_error_errno(r, "Failed to add machine object vtable: %m"); return r; } r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/machine1/machine", machine_node_enumerator, m); if (r < 0) { - log_error_errno(-r, "Failed to add machine enumerator: %m"); + log_error_errno(r, "Failed to add machine enumerator: %m"); return r; } @@ -170,7 +170,7 @@ static int manager_connect_bus(Manager *m) { match_job_removed, m); if (r < 0) { - log_error_errno(-r, "Failed to add match for JobRemoved: %m"); + log_error_errno(r, "Failed to add match for JobRemoved: %m"); return r; } @@ -184,7 +184,7 @@ static int manager_connect_bus(Manager *m) { match_unit_removed, m); if (r < 0) { - log_error_errno(-r, "Failed to add match for UnitRemoved: %m"); + log_error_errno(r, "Failed to add match for UnitRemoved: %m"); return r; } @@ -197,7 +197,7 @@ static int manager_connect_bus(Manager *m) { match_properties_changed, m); if (r < 0) { - log_error_errno(-r, "Failed to add match for PropertiesChanged: %m"); + log_error_errno(r, "Failed to add match for PropertiesChanged: %m"); return r; } @@ -211,7 +211,7 @@ static int manager_connect_bus(Manager *m) { match_reloading, m); if (r < 0) { - log_error_errno(-r, "Failed to add match for Reloading: %m"); + log_error_errno(r, "Failed to add match for Reloading: %m"); return r; } @@ -230,13 +230,13 @@ static int manager_connect_bus(Manager *m) { r = sd_bus_request_name(m->bus, "org.freedesktop.machine1", 0); if (r < 0) { - log_error_errno(-r, "Failed to register name: %m"); + log_error_errno(r, "Failed to register name: %m"); return r; } r = sd_bus_attach_event(m->bus, m->event, 0); if (r < 0) { - log_error_errno(-r, "Failed to attach bus to event loop: %m"); + log_error_errno(r, "Failed to attach bus to event loop: %m"); return r; } @@ -335,7 +335,7 @@ int main(int argc, char *argv[]) { r = manager_startup(m); if (r < 0) { - log_error_errno(-r, "Failed to fully start up daemon: %m"); + log_error_errno(r, "Failed to fully start up daemon: %m"); goto finish; } diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c index 30c67a41bd..b31dc807f4 100644 --- a/src/modules-load/modules-load.c +++ b/src/modules-load/modules-load.c @@ -82,7 +82,7 @@ static int load_module(struct kmod_ctx *ctx, const char *m) { r = kmod_module_new_from_lookup(ctx, m, &modlist); if (r < 0) { - log_error_errno(-r, "Failed to lookup alias '%s': %m", m); + log_error_errno(r, "Failed to lookup alias '%s': %m", m); return r; } @@ -142,7 +142,7 @@ static int apply_file(struct kmod_ctx *ctx, const char *path, bool ignore_enoent if (ignore_enoent && r == -ENOENT) return 0; - log_error_errno(-r, "Failed to open %s, ignoring: %m", path); + log_error_errno(r, "Failed to open %s, ignoring: %m", path); return r; } @@ -237,7 +237,7 @@ int main(int argc, char *argv[]) { r = parse_proc_cmdline(parse_proc_cmdline_item); if (r < 0) - log_warning_errno(-r, "Failed to parse kernel command line, ignoring: %m"); + log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m"); ctx = kmod_new(NULL, NULL); if (!ctx) { @@ -271,7 +271,7 @@ int main(int argc, char *argv[]) { k = conf_files_list_nulstr(&files, ".conf", NULL, conf_file_dirs); if (k < 0) { - log_error_errno(-k, "Failed to enumerate modules-load.d files: %m"); + log_error_errno(k, "Failed to enumerate modules-load.d files: %m"); if (r == 0) r = k; goto finish; diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 3e21d9acb8..2754ed8d3e 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -191,7 +191,7 @@ static int list_links(char **args, unsigned n) { r = sd_rtnl_open(&rtnl, 0); if (r < 0) { - log_error_errno(-r, "Failed to connect to netlink: %m"); + log_error_errno(r, "Failed to connect to netlink: %m"); return r; } @@ -211,7 +211,7 @@ static int list_links(char **args, unsigned n) { r = sd_rtnl_call(rtnl, req, 0, &reply); if (r < 0) { - log_error_errno(-r, "Failed to enumerate links: %m"); + log_error_errno(r, "Failed to enumerate links: %m"); return r; } @@ -323,7 +323,7 @@ static int link_status_one(sd_rtnl *rtnl, struct udev *udev, const char *name) { r = sd_rtnl_call(rtnl, req, 0, &reply); if (r < 0) { - log_error_errno(-r, "Failed to query link: %m"); + log_error_errno(r, "Failed to query link: %m"); return r; } @@ -448,7 +448,7 @@ static int link_status(char **args, unsigned n) { r = sd_rtnl_open(&rtnl, 0); if (r < 0) { - log_error_errno(-r, "Failed to connect to netlink: %m"); + log_error_errno(r, "Failed to connect to netlink: %m"); return r; } @@ -514,7 +514,7 @@ static int link_status(char **args, unsigned n) { r = sd_rtnl_call(rtnl, req, 0, &reply); if (r < 0) { - log_error_errno(-r, "Failed to enumerate links: %m"); + log_error_errno(r, "Failed to enumerate links: %m"); return r; } diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index b85044d292..e95184b8ff 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -125,7 +125,7 @@ int address_drop(Address *address, Link *link, r = sd_rtnl_message_addr_set_prefixlen(req, address->prefixlen); if (r < 0) { - log_error_errno(-r, "Could not set prefixlen: %m"); + log_error_errno(r, "Could not set prefixlen: %m"); return r; } @@ -141,7 +141,7 @@ int address_drop(Address *address, Link *link, r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL); if (r < 0) { - log_error_errno(-r, "Could not send rtnetlink message: %m"); + log_error_errno(r, "Could not send rtnetlink message: %m"); return r; } @@ -171,19 +171,19 @@ int address_update(Address *address, Link *link, r = sd_rtnl_message_addr_set_prefixlen(req, address->prefixlen); if (r < 0) { - log_error_errno(-r, "Could not set prefixlen: %m"); + log_error_errno(r, "Could not set prefixlen: %m"); return r; } r = sd_rtnl_message_addr_set_flags(req, IFA_F_PERMANENT); if (r < 0) { - log_error_errno(-r, "Could not set flags: %m"); + log_error_errno(r, "Could not set flags: %m"); return r; } r = sd_rtnl_message_addr_set_scope(req, address->scope); if (r < 0) { - log_error_errno(-r, "Could not set scope: %m"); + log_error_errno(r, "Could not set scope: %m"); return r; } @@ -224,7 +224,7 @@ int address_update(Address *address, Link *link, r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL); if (r < 0) { - log_error_errno(-r, "Could not send rtnetlink message: %m"); + log_error_errno(r, "Could not send rtnetlink message: %m"); return r; } @@ -320,19 +320,19 @@ int address_configure(Address *address, Link *link, r = sd_rtnl_message_addr_set_prefixlen(req, address->prefixlen); if (r < 0) { - log_error_errno(-r, "Could not set prefixlen: %m"); + log_error_errno(r, "Could not set prefixlen: %m"); return r; } r = sd_rtnl_message_addr_set_flags(req, IFA_F_PERMANENT); if (r < 0) { - log_error_errno(-r, "Could not set flags: %m"); + log_error_errno(r, "Could not set flags: %m"); return r; } r = sd_rtnl_message_addr_set_scope(req, address->scope); if (r < 0) { - log_error_errno(-r, "Could not set scope: %m"); + log_error_errno(r, "Could not set scope: %m"); return r; } @@ -386,7 +386,7 @@ int address_configure(Address *address, Link *link, r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL); if (r < 0) { - log_error_errno(-r, "Could not send rtnetlink message: %m"); + log_error_errno(r, "Could not send rtnetlink message: %m"); return r; } diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index e2190b591e..98a12c277a 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -357,7 +357,7 @@ int manager_udev_listen(Manager *m) { r = udev_monitor_filter_add_match_subsystem_devtype(m->udev_monitor, "net", NULL); if (r < 0) { - log_error_errno(-r, "Could not add udev monitor filter: %m"); + log_error_errno(r, "Could not add udev monitor filter: %m"); return r; } @@ -597,7 +597,7 @@ int manager_save(Manager *m) { return 0; fail: - log_error_errno(-r, "Failed to save network state to %s: %m", m->state_file); + log_error_errno(r, "Failed to save network state to %s: %m", m->state_file); unlink(m->state_file); unlink(temp_path); return r; diff --git a/src/network/networkd-netdev-veth.c b/src/network/networkd-netdev-veth.c index ed43e1b2a9..46f98e0925 100644 --- a/src/network/networkd-netdev-veth.c +++ b/src/network/networkd-netdev-veth.c @@ -47,7 +47,7 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m if (v->ifname_peer) { r = sd_rtnl_message_append_string(m, IFLA_IFNAME, v->ifname_peer); if (r < 0) { - log_error_errno(-r, "Failed to add netlink interface name: %m"); + log_error_errno(r, "Failed to add netlink interface name: %m"); return r; } } diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index 071ca4dcc5..7f717171ca 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -744,7 +744,7 @@ int netdev_load(Manager *manager) { r = conf_files_list_strv(&files, ".netdev", NULL, network_dirs); if (r < 0) { - log_error_errno(-r, "Failed to enumerate netdev files: %m"); + log_error_errno(r, "Failed to enumerate netdev files: %m"); return r; } diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 79b8e75eba..151aa12cb7 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -132,7 +132,7 @@ int network_load(Manager *manager) { r = conf_files_list_strv(&files, ".network", NULL, network_dirs); if (r < 0) { - log_error_errno(-r, "Failed to enumerate network files: %m"); + log_error_errno(r, "Failed to enumerate network files: %m"); return r; } diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index 6db1bcffbd..058f887ebf 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -114,7 +114,7 @@ int route_drop(Route *route, Link *link, RTM_DELROUTE, route->family, route->protocol); if (r < 0) { - log_error_errno(-r, "Could not create RTM_DELROUTE message: %m"); + log_error_errno(r, "Could not create RTM_DELROUTE message: %m"); return r; } @@ -124,7 +124,7 @@ int route_drop(Route *route, Link *link, else if (route->family == AF_INET6) r = sd_rtnl_message_append_in6_addr(req, RTA_GATEWAY, &route->in_addr.in6); if (r < 0) { - log_error_errno(-r, "Could not append RTA_GATEWAY attribute: %m"); + log_error_errno(r, "Could not append RTA_GATEWAY attribute: %m"); return r; } } @@ -135,13 +135,13 @@ int route_drop(Route *route, Link *link, else if (route->family == AF_INET6) r = sd_rtnl_message_append_in6_addr(req, RTA_DST, &route->dst_addr.in6); if (r < 0) { - log_error_errno(-r, "Could not append RTA_DST attribute: %m"); + log_error_errno(r, "Could not append RTA_DST attribute: %m"); return r; } r = sd_rtnl_message_route_set_dst_prefixlen(req, route->dst_prefixlen); if (r < 0) { - log_error_errno(-r, "Could not set destination prefix length: %m"); + log_error_errno(r, "Could not set destination prefix length: %m"); return r; } } @@ -152,32 +152,32 @@ int route_drop(Route *route, Link *link, else if (route->family == AF_INET6) r = sd_rtnl_message_append_in6_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in6); if (r < 0) { - log_error_errno(-r, "Could not append RTA_PREFSRC attribute: %m"); + log_error_errno(r, "Could not append RTA_PREFSRC attribute: %m"); return r; } } r = sd_rtnl_message_route_set_scope(req, route->scope); if (r < 0) { - log_error_errno(-r, "Could not set scope: %m"); + log_error_errno(r, "Could not set scope: %m"); return r; } r = sd_rtnl_message_append_u32(req, RTA_PRIORITY, route->metrics); if (r < 0) { - log_error_errno(-r, "Could not append RTA_PRIORITY attribute: %m"); + log_error_errno(r, "Could not append RTA_PRIORITY attribute: %m"); return r; } r = sd_rtnl_message_append_u32(req, RTA_OIF, link->ifindex); if (r < 0) { - log_error_errno(-r, "Could not append RTA_OIF attribute: %m"); + log_error_errno(r, "Could not append RTA_OIF attribute: %m"); return r; } r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL); if (r < 0) { - log_error_errno(-r, "Could not send rtnetlink message: %m"); + log_error_errno(r, "Could not send rtnetlink message: %m"); return r; } @@ -201,7 +201,7 @@ int route_configure(Route *route, Link *link, RTM_NEWROUTE, route->family, route->protocol); if (r < 0) { - log_error_errno(-r, "Could not create RTM_NEWROUTE message: %m"); + log_error_errno(r, "Could not create RTM_NEWROUTE message: %m"); return r; } @@ -211,7 +211,7 @@ int route_configure(Route *route, Link *link, else if (route->family == AF_INET6) r = sd_rtnl_message_append_in6_addr(req, RTA_GATEWAY, &route->in_addr.in6); if (r < 0) { - log_error_errno(-r, "Could not append RTA_GATEWAY attribute: %m"); + log_error_errno(r, "Could not append RTA_GATEWAY attribute: %m"); return r; } } @@ -222,13 +222,13 @@ int route_configure(Route *route, Link *link, else if (route->family == AF_INET6) r = sd_rtnl_message_append_in6_addr(req, RTA_DST, &route->dst_addr.in6); if (r < 0) { - log_error_errno(-r, "Could not append RTA_DST attribute: %m"); + log_error_errno(r, "Could not append RTA_DST attribute: %m"); return r; } r = sd_rtnl_message_route_set_dst_prefixlen(req, route->dst_prefixlen); if (r < 0) { - log_error_errno(-r, "Could not set destination prefix length: %m"); + log_error_errno(r, "Could not set destination prefix length: %m"); return r; } } @@ -239,32 +239,32 @@ int route_configure(Route *route, Link *link, else if (route->family == AF_INET6) r = sd_rtnl_message_append_in6_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in6); if (r < 0) { - log_error_errno(-r, "Could not append RTA_PREFSRC attribute: %m"); + log_error_errno(r, "Could not append RTA_PREFSRC attribute: %m"); return r; } } r = sd_rtnl_message_route_set_scope(req, route->scope); if (r < 0) { - log_error_errno(-r, "Could not set scope: %m"); + log_error_errno(r, "Could not set scope: %m"); return r; } r = sd_rtnl_message_append_u32(req, RTA_PRIORITY, route->metrics); if (r < 0) { - log_error_errno(-r, "Could not append RTA_PRIORITY attribute: %m"); + log_error_errno(r, "Could not append RTA_PRIORITY attribute: %m"); return r; } r = sd_rtnl_message_append_u32(req, RTA_OIF, link->ifindex); if (r < 0) { - log_error_errno(-r, "Could not append RTA_OIF attribute: %m"); + log_error_errno(r, "Could not append RTA_OIF attribute: %m"); return r; } r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL); if (r < 0) { - log_error_errno(-r, "Could not send rtnetlink message: %m"); + log_error_errno(r, "Could not send rtnetlink message: %m"); return r; } diff --git a/src/network/networkd-wait-online-manager.c b/src/network/networkd-wait-online-manager.c index 0cdc4f8811..3f2b96688c 100644 --- a/src/network/networkd-wait-online-manager.c +++ b/src/network/networkd-wait-online-manager.c @@ -134,7 +134,7 @@ static int manager_process_link(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userda return 0; fail: - log_warning_errno(-r, "Failed to process RTNL link message: %m"); + log_warning_errno(r, "Failed to process RTNL link message: %m"); return 0; } @@ -211,7 +211,7 @@ static int on_network_event(sd_event_source *s, int fd, uint32_t revents, void * HASHMAP_FOREACH(l, m->links, i) { r = link_update_monitor(l); if (r < 0) - log_warning_errno(-r, "Failed to update monitor information for %i: %m", l->ifindex); + log_warning_errno(r, "Failed to update monitor information for %i: %m", l->ifindex); } if (manager_all_configured(m)) diff --git a/src/network/networkd-wait-online.c b/src/network/networkd-wait-online.c index 40c89653b3..32a8d85301 100644 --- a/src/network/networkd-wait-online.c +++ b/src/network/networkd-wait-online.c @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) { r = manager_new(&m, arg_interfaces); if (r < 0) { - log_error_errno(-r, "Could not create manager: %m"); + log_error_errno(r, "Could not create manager: %m"); goto finish; } @@ -128,7 +128,7 @@ int main(int argc, char *argv[]) { r = sd_event_loop(m->event); if (r < 0) { - log_error_errno(-r, "Event loop failed: %m"); + log_error_errno(r, "Event loop failed: %m"); goto finish; } diff --git a/src/network/networkd.c b/src/network/networkd.c index 1020c72525..fe5860411d 100644 --- a/src/network/networkd.c +++ b/src/network/networkd.c @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) { r = get_user_creds(&user, &uid, &gid, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Cannot resolve user name %s: %m", user); + log_error_errno(r, "Cannot resolve user name %s: %m", user); goto out; } @@ -79,37 +79,37 @@ int main(int argc, char *argv[]) { r = manager_new(&m); if (r < 0) { - log_error_errno(-r, "Could not create manager: %m"); + log_error_errno(r, "Could not create manager: %m"); goto out; } r = manager_udev_listen(m); if (r < 0) { - log_error_errno(-r, "Could not connect to udev: %m"); + log_error_errno(r, "Could not connect to udev: %m"); goto out; } r = manager_rtnl_listen(m); if (r < 0) { - log_error_errno(-r, "Could not connect to rtnl: %m"); + log_error_errno(r, "Could not connect to rtnl: %m"); goto out; } r = manager_bus_listen(m); if (r < 0) { - log_error_errno(-r, "Could not connect to system bus: %m"); + log_error_errno(r, "Could not connect to system bus: %m"); goto out; } r = manager_load_config(m); if (r < 0) { - log_error_errno(-r, "Could not load configuration files: %m"); + log_error_errno(r, "Could not load configuration files: %m"); goto out; } r = manager_rtnl_enumerate_links(m); if (r < 0) { - log_error_errno(-r, "Could not enumerate links: %m"); + log_error_errno(r, "Could not enumerate links: %m"); goto out; } @@ -119,7 +119,7 @@ int main(int argc, char *argv[]) { r = sd_event_loop(m->event); if (r < 0) { - log_error_errno(-r, "Event loop failed: %m"); + log_error_errno(r, "Event loop failed: %m"); goto out; } diff --git a/src/notify/notify.c b/src/notify/notify.c index ceb235c1fb..5bf901ec6a 100644 --- a/src/notify/notify.c +++ b/src/notify/notify.c @@ -193,7 +193,7 @@ int main(int argc, char* argv[]) { r = sd_pid_notify(arg_pid, false, n); if (r < 0) { - log_error_errno(-r, "Failed to notify init system: %m"); + log_error_errno(r, "Failed to notify init system: %m"); goto finish; } diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index d06321cd7b..73e98b71ae 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -673,7 +673,7 @@ static int mount_all(const char *dest) { t = path_is_mount_point(where, true); if (t < 0) { - log_error_errno(-t, "Failed to detect whether %s is a mount point: %m", where); + log_error_errno(t, "Failed to detect whether %s is a mount point: %m", where); if (r == 0) r = t; @@ -688,12 +688,12 @@ static int mount_all(const char *dest) { t = mkdir_p(where, 0755); if (t < 0) { if (mount_table[k].fatal) { - log_error_errno(-t, "Failed to create directory %s: %m", where); + log_error_errno(t, "Failed to create directory %s: %m", where); if (r == 0) r = t; } else - log_warning_errno(-t, "Failed to create directory %s: %m", where); + log_warning_errno(t, "Failed to create directory %s: %m", where); continue; } @@ -756,7 +756,7 @@ static int mount_binds(const char *dest, char **l, bool ro) { } else if (errno == ENOENT) { r = mkdir_parents_label(where, 0755); if (r < 0) { - log_error_errno(-r, "Failed to bind mount %s: %m", *x); + log_error_errno(r, "Failed to bind mount %s: %m", *x); return r; } } else { @@ -769,7 +769,7 @@ static int mount_binds(const char *dest, char **l, bool ro) { if (S_ISDIR(source_st.st_mode)) { r = mkdir_label(where, 0755); if (r < 0 && errno != EEXIST) { - log_error_errno(-r, "Failed to create mount point %s: %m", where); + log_error_errno(r, "Failed to create mount point %s: %m", where); return r; } @@ -790,7 +790,7 @@ static int mount_binds(const char *dest, char **l, bool ro) { } else if (S_ISREG(source_st.st_mode)) { r = touch(where); if (r < 0) { - log_error_errno(-r, "Failed to create mount point %s: %m", where); + log_error_errno(r, "Failed to create mount point %s: %m", where); return r; } @@ -807,7 +807,7 @@ static int mount_binds(const char *dest, char **l, bool ro) { if (ro) { r = bind_remount_recursive(where, true); if (r < 0) { - log_error_errno(-r, "Read-Only bind mount failed: %m"); + log_error_errno(r, "Read-Only bind mount failed: %m"); return r; } } @@ -829,7 +829,7 @@ static int mount_tmpfs(const char *dest) { r = mkdir_label(where, 0755); if (r < 0 && errno != EEXIST) { - log_error_errno(-r, "creating mount point for tmpfs %s failed: %m", where); + log_error_errno(r, "creating mount point for tmpfs %s failed: %m", where); return r; } @@ -895,7 +895,7 @@ static int setup_timezone(const char *dest) { r = mkdir_parents(where, 0755); if (r < 0) { - log_error_errno(-r, "Failed to create directory for timezone info %s in container: %m", where); + log_error_errno(r, "Failed to create directory for timezone info %s in container: %m", where); return 0; } @@ -933,14 +933,14 @@ static int setup_resolv_conf(const char *dest) { * fails, it fails, but meh... */ r = mkdir_parents(where, 0755); if (r < 0) { - log_warning_errno(-r, "Failed to create parent directory for resolv.conf %s: %m", where); + log_warning_errno(r, "Failed to create parent directory for resolv.conf %s: %m", where); return 0; } r = copy_file("/etc/resolv.conf", where, O_TRUNC|O_NOFOLLOW, 0644); if (r < 0) { - log_warning_errno(-r, "Failed to copy /etc/resolv.conf to %s: %m", where); + log_warning_errno(r, "Failed to copy /etc/resolv.conf to %s: %m", where); return 0; } @@ -962,7 +962,7 @@ static int setup_volatile_state(const char *directory) { r = bind_remount_recursive(directory, true); if (r < 0) { - log_error_errno(-r, "Failed to remount %s read-only: %m", directory); + log_error_errno(r, "Failed to remount %s read-only: %m", directory); return r; } @@ -1028,7 +1028,7 @@ static int setup_volatile(const char *directory) { r = bind_remount_recursive(t, true); if (r < 0) { - log_error_errno(-r, "Failed to remount %s read-only: %m", t); + log_error_errno(r, "Failed to remount %s read-only: %m", t); goto fail; } @@ -1081,7 +1081,7 @@ static int setup_boot_id(const char *dest) { r = sd_id128_randomize(&rnd); if (r < 0) { - log_error_errno(-r, "Failed to generate random boot id: %m"); + log_error_errno(r, "Failed to generate random boot id: %m"); return r; } @@ -1089,7 +1089,7 @@ static int setup_boot_id(const char *dest) { r = write_string_file(from, as_uuid); if (r < 0) { - log_error_errno(-r, "Failed to write boot id: %m"); + log_error_errno(r, "Failed to write boot id: %m"); return r; } @@ -1146,7 +1146,7 @@ static int copy_devnodes(const char *dest) { } else { r = mkdir_parents(to, 0775); if (r < 0) { - log_error_errno(-r, "Failed to create parent directory of %s: %m", to); + log_error_errno(r, "Failed to create parent directory of %s: %m", to); return -r; } @@ -1193,7 +1193,7 @@ static int setup_dev_console(const char *dest, const char *console) { r = chmod_and_chown(console, 0600, 0, 0); if (r < 0) { - log_error_errno(-r, "Failed to correct access mode for TTY: %m"); + log_error_errno(r, "Failed to correct access mode for TTY: %m"); return r; } @@ -1256,7 +1256,7 @@ static int setup_kmsg(const char *dest, int kmsg_socket) { r = chmod_and_chown(from, 0600, 0, 0); if (r < 0) { - log_error_errno(-r, "Failed to correct access mode for /dev/kmsg: %m"); + log_error_errno(r, "Failed to correct access mode for /dev/kmsg: %m"); return r; } @@ -1319,7 +1319,7 @@ static int setup_journal(const char *directory) { if (r == -ENOENT && arg_link_journal == LINK_AUTO) return 0; else if (r < 0) { - log_error_errno(-r, "Failed to read machine ID from %s: %m", p); + log_error_errno(r, "Failed to read machine ID from %s: %m", p); return r; } @@ -1330,13 +1330,13 @@ static int setup_journal(const char *directory) { /* Verify validity */ r = sd_id128_from_string(id, &machine_id); if (r < 0) { - log_error_errno(-r, "Failed to parse machine ID from %s: %m", p); + log_error_errno(r, "Failed to parse machine ID from %s: %m", p); return r; } r = sd_id128_get_machine(&this_id); if (r < 0) { - log_error_errno(-r, "Failed to retrieve machine ID: %m"); + log_error_errno(r, "Failed to retrieve machine ID: %m"); return r; } @@ -1476,7 +1476,7 @@ static int register_machine(pid_t pid, int local_ifindex) { r = sd_bus_default_system(&bus); if (r < 0) { - log_error_errno(-r, "Failed to open system bus: %m"); + log_error_errno(r, "Failed to open system bus: %m"); return r; } @@ -1508,7 +1508,7 @@ static int register_machine(pid_t pid, int local_ifindex) { "org.freedesktop.machine1.Manager", "CreateMachineWithNetwork"); if (r < 0) { - log_error_errno(-r, "Failed to create message: %m"); + log_error_errno(r, "Failed to create message: %m"); return r; } @@ -1523,27 +1523,27 @@ static int register_machine(pid_t pid, int local_ifindex) { strempty(arg_directory), local_ifindex > 0 ? 1 : 0, local_ifindex); if (r < 0) { - log_error_errno(-r, "Failed to append message arguments: %m"); + log_error_errno(r, "Failed to append message arguments: %m"); return r; } r = sd_bus_message_open_container(m, 'a', "(sv)"); if (r < 0) { - log_error_errno(-r, "Failed to open container: %m"); + log_error_errno(r, "Failed to open container: %m"); return r; } if (!isempty(arg_slice)) { r = sd_bus_message_append(m, "(sv)", "Slice", "s", arg_slice); if (r < 0) { - log_error_errno(-r, "Failed to append slice: %m"); + log_error_errno(r, "Failed to append slice: %m"); return r; } } r = sd_bus_message_append(m, "(sv)", "DevicePolicy", "s", "strict"); if (r < 0) { - log_error_errno(-r, "Failed to add device policy: %m"); + log_error_errno(r, "Failed to add device policy: %m"); return r; } @@ -1569,13 +1569,13 @@ static int register_machine(pid_t pid, int local_ifindex) { "/dev/pts/ptmx", "rw", "char-pts", "rw"); if (r < 0) { - log_error_errno(-r, "Failed to add device whitelist: %m"); + log_error_errno(r, "Failed to add device whitelist: %m"); return r; } r = sd_bus_message_close_container(m); if (r < 0) { - log_error_errno(-r, "Failed to close container: %m"); + log_error_errno(r, "Failed to close container: %m"); return r; } @@ -1602,7 +1602,7 @@ static int terminate_machine(pid_t pid) { r = sd_bus_default_system(&bus); if (r < 0) { - log_error_errno(-r, "Failed to open system bus: %m"); + log_error_errno(r, "Failed to open system bus: %m"); return r; } @@ -1656,7 +1656,7 @@ static int reset_audit_loginuid(void) { if (r == -ENOENT) return 0; if (r < 0) { - log_error_errno(-r, "Failed to read /proc/self/loginuid: %m"); + log_error_errno(r, "Failed to read /proc/self/loginuid: %m"); return r; } @@ -1746,85 +1746,85 @@ static int setup_veth(pid_t pid, char iface_name[IFNAMSIZ], int *ifi) { r = sd_rtnl_open(&rtnl, 0); if (r < 0) { - log_error_errno(-r, "Failed to connect to netlink: %m"); + log_error_errno(r, "Failed to connect to netlink: %m"); return r; } r = sd_rtnl_message_new_link(rtnl, &m, RTM_NEWLINK, 0); if (r < 0) { - log_error_errno(-r, "Failed to allocate netlink message: %m"); + log_error_errno(r, "Failed to allocate netlink message: %m"); return r; } r = sd_rtnl_message_append_string(m, IFLA_IFNAME, iface_name); if (r < 0) { - log_error_errno(-r, "Failed to add netlink interface name: %m"); + log_error_errno(r, "Failed to add netlink interface name: %m"); return r; } r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, &mac_host); if (r < 0) { - log_error_errno(-r, "Failed to add netlink MAC address: %m"); + log_error_errno(r, "Failed to add netlink MAC address: %m"); return r; } r = sd_rtnl_message_open_container(m, IFLA_LINKINFO); if (r < 0) { - log_error_errno(-r, "Failed to open netlink container: %m"); + log_error_errno(r, "Failed to open netlink container: %m"); return r; } r = sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA, "veth"); if (r < 0) { - log_error_errno(-r, "Failed to open netlink container: %m"); + log_error_errno(r, "Failed to open netlink container: %m"); return r; } r = sd_rtnl_message_open_container(m, VETH_INFO_PEER); if (r < 0) { - log_error_errno(-r, "Failed to open netlink container: %m"); + log_error_errno(r, "Failed to open netlink container: %m"); return r; } r = sd_rtnl_message_append_string(m, IFLA_IFNAME, "host0"); if (r < 0) { - log_error_errno(-r, "Failed to add netlink interface name: %m"); + log_error_errno(r, "Failed to add netlink interface name: %m"); return r; } r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, &mac_container); if (r < 0) { - log_error_errno(-r, "Failed to add netlink MAC address: %m"); + log_error_errno(r, "Failed to add netlink MAC address: %m"); return r; } r = sd_rtnl_message_append_u32(m, IFLA_NET_NS_PID, pid); if (r < 0) { - log_error_errno(-r, "Failed to add netlink namespace field: %m"); + log_error_errno(r, "Failed to add netlink namespace field: %m"); return r; } r = sd_rtnl_message_close_container(m); if (r < 0) { - log_error_errno(-r, "Failed to close netlink container: %m"); + log_error_errno(r, "Failed to close netlink container: %m"); return r; } r = sd_rtnl_message_close_container(m); if (r < 0) { - log_error_errno(-r, "Failed to close netlink container: %m"); + log_error_errno(r, "Failed to close netlink container: %m"); return r; } r = sd_rtnl_message_close_container(m); if (r < 0) { - log_error_errno(-r, "Failed to close netlink container: %m"); + log_error_errno(r, "Failed to close netlink container: %m"); return r; } r = sd_rtnl_call(rtnl, m, 0, NULL); if (r < 0) { - log_error_errno(-r, "Failed to add new veth interfaces: %m"); + log_error_errno(r, "Failed to add new veth interfaces: %m"); return r; } @@ -1863,37 +1863,37 @@ static int setup_bridge(const char veth_name[], int *ifi) { r = sd_rtnl_open(&rtnl, 0); if (r < 0) { - log_error_errno(-r, "Failed to connect to netlink: %m"); + log_error_errno(r, "Failed to connect to netlink: %m"); return r; } r = sd_rtnl_message_new_link(rtnl, &m, RTM_SETLINK, 0); if (r < 0) { - log_error_errno(-r, "Failed to allocate netlink message: %m"); + log_error_errno(r, "Failed to allocate netlink message: %m"); return r; } r = sd_rtnl_message_link_set_flags(m, IFF_UP, IFF_UP); if (r < 0) { - log_error_errno(-r, "Failed to set IFF_UP flag: %m"); + log_error_errno(r, "Failed to set IFF_UP flag: %m"); return r; } r = sd_rtnl_message_append_string(m, IFLA_IFNAME, veth_name); if (r < 0) { - log_error_errno(-r, "Failed to add netlink interface name field: %m"); + log_error_errno(r, "Failed to add netlink interface name field: %m"); return r; } r = sd_rtnl_message_append_u32(m, IFLA_MASTER, bridge); if (r < 0) { - log_error_errno(-r, "Failed to add netlink master field: %m"); + log_error_errno(r, "Failed to add netlink master field: %m"); return r; } r = sd_rtnl_call(rtnl, m, 0, NULL); if (r < 0) { - log_error_errno(-r, "Failed to add veth interface to bridge: %m"); + log_error_errno(r, "Failed to add veth interface to bridge: %m"); return r; } @@ -1940,7 +1940,7 @@ static int move_network_interfaces(pid_t pid) { r = sd_rtnl_open(&rtnl, 0); if (r < 0) { - log_error_errno(-r, "Failed to connect to netlink: %m"); + log_error_errno(r, "Failed to connect to netlink: %m"); return r; } @@ -1960,19 +1960,19 @@ static int move_network_interfaces(pid_t pid) { r = sd_rtnl_message_new_link(rtnl, &m, RTM_SETLINK, ifi); if (r < 0) { - log_error_errno(-r, "Failed to allocate netlink message: %m"); + log_error_errno(r, "Failed to allocate netlink message: %m"); return r; } r = sd_rtnl_message_append_u32(m, IFLA_NET_NS_PID, pid); if (r < 0) { - log_error_errno(-r, "Failed to append namespace PID to netlink message: %m"); + log_error_errno(r, "Failed to append namespace PID to netlink message: %m"); return r; } r = sd_rtnl_call(rtnl, m, 0, NULL); if (r < 0) { - log_error_errno(-r, "Failed to move interface %s to namespace: %m", *i); + log_error_errno(r, "Failed to move interface %s to namespace: %m", *i); return r; } } @@ -1994,7 +1994,7 @@ static int setup_macvlan(pid_t pid) { r = sd_rtnl_open(&rtnl, 0); if (r < 0) { - log_error_errno(-r, "Failed to connect to netlink: %m"); + log_error_errno(r, "Failed to connect to netlink: %m"); return r; } @@ -2015,13 +2015,13 @@ static int setup_macvlan(pid_t pid) { r = sd_rtnl_message_new_link(rtnl, &m, RTM_NEWLINK, 0); if (r < 0) { - log_error_errno(-r, "Failed to allocate netlink message: %m"); + log_error_errno(r, "Failed to allocate netlink message: %m"); return r; } r = sd_rtnl_message_append_u32(m, IFLA_LINK, ifi); if (r < 0) { - log_error_errno(-r, "Failed to add netlink interface index: %m"); + log_error_errno(r, "Failed to add netlink interface index: %m"); return r; } @@ -2033,49 +2033,49 @@ static int setup_macvlan(pid_t pid) { r = sd_rtnl_message_append_string(m, IFLA_IFNAME, n); if (r < 0) { - log_error_errno(-r, "Failed to add netlink interface name: %m"); + log_error_errno(r, "Failed to add netlink interface name: %m"); return r; } r = sd_rtnl_message_append_u32(m, IFLA_NET_NS_PID, pid); if (r < 0) { - log_error_errno(-r, "Failed to add netlink namespace field: %m"); + log_error_errno(r, "Failed to add netlink namespace field: %m"); return r; } r = sd_rtnl_message_open_container(m, IFLA_LINKINFO); if (r < 0) { - log_error_errno(-r, "Failed to open netlink container: %m"); + log_error_errno(r, "Failed to open netlink container: %m"); return r; } r = sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA, "macvlan"); if (r < 0) { - log_error_errno(-r, "Failed to open netlink container: %m"); + log_error_errno(r, "Failed to open netlink container: %m"); return r; } r = sd_rtnl_message_append_u32(m, IFLA_MACVLAN_MODE, MACVLAN_MODE_BRIDGE); if (r < 0) { - log_error_errno(-r, "Failed to append macvlan mode: %m"); + log_error_errno(r, "Failed to append macvlan mode: %m"); return r; } r = sd_rtnl_message_close_container(m); if (r < 0) { - log_error_errno(-r, "Failed to close netlink container: %m"); + log_error_errno(r, "Failed to close netlink container: %m"); return r; } r = sd_rtnl_message_close_container(m); if (r < 0) { - log_error_errno(-r, "Failed to close netlink container: %m"); + log_error_errno(r, "Failed to close netlink container: %m"); return r; } r = sd_rtnl_call(rtnl, m, 0, NULL); if (r < 0) { - log_error_errno(-r, "Failed to add new macvlan interfaces: %m"); + log_error_errno(r, "Failed to add new macvlan interfaces: %m"); return r; } } @@ -2108,7 +2108,7 @@ static int setup_seccomp(void) { r = seccomp_add_secondary_archs(seccomp); if (r < 0) { - log_error_errno(-r, "Failed to add secondary archs to seccomp filter: %m"); + log_error_errno(r, "Failed to add secondary archs to seccomp filter: %m"); goto finish; } @@ -2117,7 +2117,7 @@ static int setup_seccomp(void) { if (r == -EFAULT) continue; /* unknown syscall */ if (r < 0) { - log_error_errno(-r, "Failed to block syscall: %m"); + log_error_errno(r, "Failed to block syscall: %m"); goto finish; } } @@ -2140,19 +2140,19 @@ static int setup_seccomp(void) { SCMP_A0(SCMP_CMP_EQ, AF_NETLINK), SCMP_A2(SCMP_CMP_EQ, NETLINK_AUDIT)); if (r < 0) { - log_error_errno(-r, "Failed to add audit seccomp rule: %m"); + log_error_errno(r, "Failed to add audit seccomp rule: %m"); goto finish; } r = seccomp_attr_set(seccomp, SCMP_FLTATR_CTL_NNP, 0); if (r < 0) { - log_error_errno(-r, "Failed to unset NO_NEW_PRIVS: %m"); + log_error_errno(r, "Failed to unset NO_NEW_PRIVS: %m"); goto finish; } r = seccomp_load(seccomp); if (r < 0) - log_error_errno(-r, "Failed to install seccomp audit filter: %m"); + log_error_errno(r, "Failed to install seccomp audit filter: %m"); finish: seccomp_release(seccomp); @@ -2350,7 +2350,7 @@ static int dissect_image( r = udev_enumerate_scan_devices(e); if (r < 0) { - log_error_errno(-r, "Failed to scan for partition devices of %s: %m", arg_image); + log_error_errno(r, "Failed to scan for partition devices of %s: %m", arg_image); return r; } @@ -2581,7 +2581,7 @@ static int mount_devices( if (root_device) { r = mount_device(root_device, arg_directory, NULL, root_device_rw); if (r < 0) { - log_error_errno(-r, "Failed to mount root directory: %m"); + log_error_errno(r, "Failed to mount root directory: %m"); return r; } } @@ -2589,7 +2589,7 @@ static int mount_devices( if (home_device) { r = mount_device(home_device, arg_directory, "/home", home_device_rw); if (r < 0) { - log_error_errno(-r, "Failed to mount home directory: %m"); + log_error_errno(r, "Failed to mount home directory: %m"); return r; } } @@ -2597,7 +2597,7 @@ static int mount_devices( if (srv_device) { r = mount_device(srv_device, arg_directory, "/srv", srv_device_rw); if (r < 0) { - log_error_errno(-r, "Failed to mount server data directory: %m"); + log_error_errno(r, "Failed to mount server data directory: %m"); return r; } } @@ -2857,13 +2857,13 @@ static int change_uid_gid(char **_home) { r = mkdir_parents(home, 0775); if (r < 0) { - log_error_errno(-r, "Failed to make home root directory: %m"); + log_error_errno(r, "Failed to make home root directory: %m"); return r; } r = mkdir_safe(home, 0755, uid, gid); if (r < 0 && r != -EEXIST) { - log_error_errno(-r, "Failed to make home directory: %m"); + log_error_errno(r, "Failed to make home directory: %m"); return r; } @@ -2917,7 +2917,7 @@ static int wait_for_container(pid_t pid, ContainerStatus *container) { r = wait_for_terminate(pid, &status); if (r < 0) { - log_warning_errno(-r, "Failed to wait for container: %m"); + log_warning_errno(r, "Failed to wait for container: %m"); return r; } @@ -3050,7 +3050,7 @@ int main(int argc, char *argv[]) { if (n_fd_passed > 0) { k = fdset_new_listen_fds(&fds, false); if (k < 0) { - log_error_errno(-k, "Failed to collect file descriptors: %m"); + log_error_errno(k, "Failed to collect file descriptors: %m"); goto finish; } } @@ -3156,7 +3156,7 @@ int main(int argc, char *argv[]) { r = barrier_create(&barrier); if (r < 0) { - log_error_errno(-r, "Cannot initialize IPC barrier: %m"); + log_error_errno(r, "Cannot initialize IPC barrier: %m"); goto finish; } @@ -3230,7 +3230,7 @@ int main(int argc, char *argv[]) { k = -EINVAL; } - log_error_errno(-k, "Failed to open console: %m"); + log_error_errno(k, "Failed to open console: %m"); _exit(EXIT_FAILURE); } @@ -3287,7 +3287,7 @@ int main(int argc, char *argv[]) { if (arg_read_only) { k = bind_remount_recursive(arg_directory, true); if (k < 0) { - log_error_errno(-k, "Failed to make tree read-only: %m"); + log_error_errno(k, "Failed to make tree read-only: %m"); _exit(EXIT_FAILURE); } } @@ -3521,7 +3521,7 @@ int main(int argc, char *argv[]) { r = sd_event_new(&event); if (r < 0) { - log_error_errno(-r, "Failed to get default event source: %m"); + log_error_errno(r, "Failed to get default event source: %m"); goto finish; } @@ -3540,13 +3540,13 @@ int main(int argc, char *argv[]) { r = pty_forward_new(event, master, &forward); if (r < 0) { - log_error_errno(-r, "Failed to create PTY forwarder: %m"); + log_error_errno(r, "Failed to create PTY forwarder: %m"); goto finish; } r = sd_event_loop(event); if (r < 0) { - log_error_errno(-r, "Failed to run event loop: %m"); + log_error_errno(r, "Failed to run event loop: %m"); return r; } diff --git a/src/path/path.c b/src/path/path.c index e4d8d1d53c..65016cda3e 100644 --- a/src/path/path.c +++ b/src/path/path.c @@ -88,7 +88,7 @@ static int list_homes(void) { if (q == -ENXIO) continue; if (q < 0) { - log_error_errno(-r, "Failed to query %s: %m", path_table[i]); + log_error_errno(r, "Failed to query %s: %m", path_table[i]); r = q; continue; } @@ -109,7 +109,7 @@ static int print_home(const char *n) { r = sd_path_home(i, arg_suffix, &p); if (r < 0) { - log_error_errno(-r, "Failed to query %s: %m", n); + log_error_errno(r, "Failed to query %s: %m", n); return r; } diff --git a/src/quotacheck/quotacheck.c b/src/quotacheck/quotacheck.c index 4ebce5cd03..ebbd632794 100644 --- a/src/quotacheck/quotacheck.c +++ b/src/quotacheck/quotacheck.c @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) { r = parse_proc_cmdline(parse_proc_cmdline_item); if (r < 0) - log_warning_errno(-r, "Failed to parse kernel command line, ignoring: %m"); + log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m"); test_files(); diff --git a/src/random-seed/random-seed.c b/src/random-seed/random-seed.c index 90ec8af7b8..7714bcef9f 100644 --- a/src/random-seed/random-seed.c +++ b/src/random-seed/random-seed.c @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) { r = mkdir_parents_label(RANDOM_SEED, 0755); if (r < 0) { - log_error_errno(-r, "Failed to create directory " RANDOM_SEED_DIR ": %m"); + log_error_errno(r, "Failed to create directory " RANDOM_SEED_DIR ": %m"); goto finish; } diff --git a/src/remount-fs/remount-fs.c b/src/remount-fs/remount-fs.c index e30c344310..2969404185 100644 --- a/src/remount-fs/remount-fs.c +++ b/src/remount-fs/remount-fs.c @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) { k = hashmap_put(pids, UINT_TO_PTR(pid), s); if (k < 0) { - log_error_errno(-k, "Failed to add PID to set: %m"); + log_error_errno(k, "Failed to add PID to set: %m"); ret = EXIT_FAILURE; continue; } diff --git a/src/resolve-host/resolve-host.c b/src/resolve-host/resolve-host.c index e9c0d69b02..457b3e2d31 100644 --- a/src/resolve-host/resolve-host.c +++ b/src/resolve-host/resolve-host.c @@ -155,7 +155,7 @@ static int resolve_host(sd_bus *bus, const char *name) { r = in_addr_to_string(family, a, &pretty); if (r < 0) { - log_error_errno(-r, "%s: failed to print address: %m", name); + log_error_errno(r, "%s: failed to print address: %m", name); continue; } @@ -614,7 +614,7 @@ int main(int argc, char **argv) { r = sd_bus_open_system(&bus); if (r < 0) { - log_error_errno(-r, "sd_bus_open_system: %m"); + log_error_errno(r, "sd_bus_open_system: %m"); goto finish; } diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c index 517d20eca9..c6b5915853 100644 --- a/src/resolve/resolved-bus.c +++ b/src/resolve/resolved-bus.c @@ -251,7 +251,7 @@ static void bus_method_resolve_hostname_complete(DnsQuery *q) { finish: if (r < 0) { - log_error_errno(-r, "Failed to send hostname reply: %m"); + log_error_errno(r, "Failed to send hostname reply: %m"); sd_bus_reply_method_errno(q->request, -r, NULL); } @@ -419,7 +419,7 @@ static void bus_method_resolve_address_complete(DnsQuery *q) { finish: if (r < 0) { - log_error_errno(-r, "Failed to send address reply: %m"); + log_error_errno(r, "Failed to send address reply: %m"); sd_bus_reply_method_errno(q->request, -r, NULL); } @@ -591,7 +591,7 @@ static void bus_method_resolve_record_complete(DnsQuery *q) { finish: if (r < 0) { - log_error_errno(-r, "Failed to send record reply: %m"); + log_error_errno(r, "Failed to send record reply: %m"); sd_bus_reply_method_errno(q->request, -r, NULL); } @@ -690,7 +690,7 @@ static int match_prepare_for_sleep(sd_bus *bus, sd_bus_message *message, void *u r = sd_bus_message_read(message, "b", &b); if (r < 0) { - log_debug_errno(-r, "Failed to parse PrepareForSleep signal: %m"); + log_debug_errno(r, "Failed to parse PrepareForSleep signal: %m"); return 0; } @@ -717,11 +717,11 @@ int manager_connect_bus(Manager *m) { * boot. Let's try in 5s again. As soon as we have * kdbus we can stop doing this... */ - log_debug_errno(-r, "Failed to connect to bus, trying again in 5s: %m"); + log_debug_errno(r, "Failed to connect to bus, trying again in 5s: %m"); r = sd_event_add_time(m->event, &m->bus_retry_event_source, CLOCK_MONOTONIC, now(CLOCK_MONOTONIC) + 5*USEC_PER_SEC, 0, on_bus_retry, m); if (r < 0) { - log_error_errno(-r, "Failed to install bus reconnect time event: %m"); + log_error_errno(r, "Failed to install bus reconnect time event: %m"); return r; } @@ -730,19 +730,19 @@ int manager_connect_bus(Manager *m) { r = sd_bus_add_object_vtable(m->bus, NULL, "/org/freedesktop/resolve1", "org.freedesktop.resolve1.Manager", resolve_vtable, m); if (r < 0) { - log_error_errno(-r, "Failed to register object: %m"); + log_error_errno(r, "Failed to register object: %m"); return r; } r = sd_bus_request_name(m->bus, "org.freedesktop.resolve1", 0); if (r < 0) { - log_error_errno(-r, "Failed to register name: %m"); + log_error_errno(r, "Failed to register name: %m"); return r; } r = sd_bus_attach_event(m->bus, m->event, 0); if (r < 0) { - log_error_errno(-r, "Failed to attach bus to event loop: %m"); + log_error_errno(r, "Failed to attach bus to event loop: %m"); return r; } @@ -755,7 +755,7 @@ int manager_connect_bus(Manager *m) { match_prepare_for_sleep, m); if (r < 0) - log_error_errno(-r, "Failed to add match for PrepareForSleep: %m"); + log_error_errno(r, "Failed to add match for PrepareForSleep: %m"); return 0; } diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c index a31e7929b7..a3631f08a8 100644 --- a/src/resolve/resolved-dns-scope.c +++ b/src/resolve/resolved-dns-scope.c @@ -539,7 +539,7 @@ void dns_scope_process_query(DnsScope *s, DnsStream *stream, DnsPacket *p) { r = dns_packet_extract(p); if (r < 0) { - log_debug_errno(-r, "Failed to extract resources from incoming packet: %m"); + log_debug_errno(r, "Failed to extract resources from incoming packet: %m"); return; } @@ -551,7 +551,7 @@ void dns_scope_process_query(DnsScope *s, DnsStream *stream, DnsPacket *p) { r = dns_zone_lookup(&s->zone, p->question, &answer, &soa, &tentative); if (r < 0) { - log_debug_errno(-r, "Failed to lookup key: %m"); + log_debug_errno(r, "Failed to lookup key: %m"); return; } if (r == 0) @@ -562,7 +562,7 @@ void dns_scope_process_query(DnsScope *s, DnsStream *stream, DnsPacket *p) { r = dns_scope_make_reply_packet(s, DNS_PACKET_ID(p), DNS_RCODE_SUCCESS, p->question, answer, soa, tentative, &reply); if (r < 0) { - log_debug_errno(-r, "Failed to build reply packet: %m"); + log_debug_errno(r, "Failed to build reply packet: %m"); return; } @@ -581,7 +581,7 @@ void dns_scope_process_query(DnsScope *s, DnsStream *stream, DnsPacket *p) { return; } if (fd < 0) { - log_debug_errno(-fd, "Failed to get reply socket: %m"); + log_debug_errno(fd, "Failed to get reply socket: %m"); return; } @@ -594,7 +594,7 @@ void dns_scope_process_query(DnsScope *s, DnsStream *stream, DnsPacket *p) { } if (r < 0) { - log_debug_errno(-r, "Failed to send reply packet: %m"); + log_debug_errno(r, "Failed to send reply packet: %m"); return; } } @@ -688,13 +688,13 @@ static int on_conflict_dispatch(sd_event_source *es, usec_t usec, void *userdata r = dns_scope_make_conflict_packet(scope, rr, &p); if (r < 0) { - log_error_errno(-r, "Failed to make conflict packet: %m"); + log_error_errno(r, "Failed to make conflict packet: %m"); return 0; } r = dns_scope_emit(scope, p); if (r < 0) - log_debug_errno(-r, "Failed to send conflict packet: %m"); + log_debug_errno(r, "Failed to send conflict packet: %m"); } return 0; @@ -722,7 +722,7 @@ int dns_scope_notify_conflict(DnsScope *scope, DnsResourceRecord *rr) { if (r == -EEXIST || r == 0) return 0; if (r < 0) { - log_debug_errno(-r, "Failed to queue conflicting RR: %m"); + log_debug_errno(r, "Failed to queue conflicting RR: %m"); return r; } @@ -741,7 +741,7 @@ int dns_scope_notify_conflict(DnsScope *scope, DnsResourceRecord *rr) { LLMNR_JITTER_INTERVAL_USEC, on_conflict_dispatch, scope); if (r < 0) { - log_debug_errno(-r, "Failed to add conflict dispatch event: %m"); + log_debug_errno(r, "Failed to add conflict dispatch event: %m"); return r; } @@ -772,7 +772,7 @@ void dns_scope_check_conflicts(DnsScope *scope, DnsPacket *p) { r = dns_packet_extract(p); if (r < 0) { - log_debug_errno(-r, "Failed to extract packet: %m"); + log_debug_errno(r, "Failed to extract packet: %m"); return; } diff --git a/src/resolve/resolved-dns-zone.c b/src/resolve/resolved-dns-zone.c index c463fe9c41..a4c9b7d7af 100644 --- a/src/resolve/resolved-dns-zone.c +++ b/src/resolve/resolved-dns-zone.c @@ -570,7 +570,7 @@ static int dns_zone_item_verify(DnsZoneItem *i) { i->state = DNS_ZONE_ITEM_VERIFYING; r = dns_zone_item_probe_start(i); if (r < 0) { - log_error_errno(-r, "Failed to start probing for verifying RR: %m"); + log_error_errno(r, "Failed to start probing for verifying RR: %m"); i->state = DNS_ZONE_ITEM_ESTABLISHED; return r; } diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c index 2cbc37ceaa..f94e4bb6f0 100644 --- a/src/resolve/resolved-link.c +++ b/src/resolve/resolved-link.c @@ -88,7 +88,7 @@ static void link_allocate_scopes(Link *l) { if (!l->unicast_scope) { r = dns_scope_new(l->manager, &l->unicast_scope, l, DNS_PROTOCOL_DNS, AF_UNSPEC); if (r < 0) - log_warning_errno(-r, "Failed to allocate DNS scope: %m"); + log_warning_errno(r, "Failed to allocate DNS scope: %m"); } } else l->unicast_scope = dns_scope_free(l->unicast_scope); @@ -99,7 +99,7 @@ static void link_allocate_scopes(Link *l) { if (!l->llmnr_ipv4_scope) { r = dns_scope_new(l->manager, &l->llmnr_ipv4_scope, l, DNS_PROTOCOL_LLMNR, AF_INET); if (r < 0) - log_warning_errno(-r, "Failed to allocate LLMNR IPv4 scope: %m"); + log_warning_errno(r, "Failed to allocate LLMNR IPv4 scope: %m"); } } else l->llmnr_ipv4_scope = dns_scope_free(l->llmnr_ipv4_scope); @@ -111,7 +111,7 @@ static void link_allocate_scopes(Link *l) { if (!l->llmnr_ipv6_scope) { r = dns_scope_new(l->manager, &l->llmnr_ipv6_scope, l, DNS_PROTOCOL_LLMNR, AF_INET6); if (r < 0) - log_warning_errno(-r, "Failed to allocate LLMNR IPv6 scope: %m"); + log_warning_errno(r, "Failed to allocate LLMNR IPv6 scope: %m"); } } else l->llmnr_ipv6_scope = dns_scope_free(l->llmnr_ipv6_scope); @@ -439,11 +439,11 @@ void link_address_add_rrs(LinkAddress *a, bool force_remove) { r = dns_zone_put(&a->link->llmnr_ipv4_scope->zone, a->link->llmnr_ipv4_scope, a->llmnr_address_rr, true); if (r < 0) - log_warning_errno(-r, "Failed to add A record to LLMNR zone: %m"); + log_warning_errno(r, "Failed to add A record to LLMNR zone: %m"); r = dns_zone_put(&a->link->llmnr_ipv4_scope->zone, a->link->llmnr_ipv4_scope, a->llmnr_ptr_rr, false); if (r < 0) - log_warning_errno(-r, "Failed to add IPv6 PTR record to LLMNR zone: %m"); + log_warning_errno(r, "Failed to add IPv6 PTR record to LLMNR zone: %m"); } else { if (a->llmnr_address_rr) { if (a->link->llmnr_ipv4_scope) @@ -496,11 +496,11 @@ void link_address_add_rrs(LinkAddress *a, bool force_remove) { r = dns_zone_put(&a->link->llmnr_ipv6_scope->zone, a->link->llmnr_ipv6_scope, a->llmnr_address_rr, true); if (r < 0) - log_warning_errno(-r, "Failed to add AAAA record to LLMNR zone: %m"); + log_warning_errno(r, "Failed to add AAAA record to LLMNR zone: %m"); r = dns_zone_put(&a->link->llmnr_ipv6_scope->zone, a->link->llmnr_ipv6_scope, a->llmnr_ptr_rr, false); if (r < 0) - log_warning_errno(-r, "Failed to add IPv6 PTR record to LLMNR zone: %m"); + log_warning_errno(r, "Failed to add IPv6 PTR record to LLMNR zone: %m"); } else { if (a->llmnr_address_rr) { if (a->link->llmnr_ipv6_scope) @@ -519,7 +519,7 @@ void link_address_add_rrs(LinkAddress *a, bool force_remove) { return; fail: - log_debug_errno(-r, "Failed to update address RRs: %m"); + log_debug_errno(r, "Failed to update address RRs: %m"); } int link_address_update_rtnl(LinkAddress *a, sd_rtnl_message *m) { diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c index 43031bc458..9f61c9d9a2 100644 --- a/src/resolve/resolved-manager.c +++ b/src/resolve/resolved-manager.c @@ -100,7 +100,7 @@ static int manager_process_link(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userda return 0; fail: - log_warning_errno(-r, "Failed to process RTNL link message: %m"); + log_warning_errno(r, "Failed to process RTNL link message: %m"); return 0; } @@ -185,7 +185,7 @@ static int manager_process_address(sd_rtnl *rtnl, sd_rtnl_message *mm, void *use return 0; fail: - log_warning_errno(-r, "Failed to process RTNL address message: %m"); + log_warning_errno(r, "Failed to process RTNL address message: %m"); return 0; } @@ -278,12 +278,12 @@ static int on_network_event(sd_event_source *s, int fd, uint32_t revents, void * HASHMAP_FOREACH(l, m->links, i) { r = link_update_monitor(l); if (r < 0) - log_warning_errno(-r, "Failed to update monitor information for %i: %m", l->ifindex); + log_warning_errno(r, "Failed to update monitor information for %i: %m", l->ifindex); } r = manager_write_resolv_conf(m); if (r < 0) - log_warning_errno(-r, "Could not update resolv.conf: %m"); + log_warning_errno(r, "Could not update resolv.conf: %m"); return 0; } @@ -380,7 +380,7 @@ static int manager_watch_hostname(Manager *m) { /* kernels prior to 3.2 don't support polling this file. Ignore the failure. */ m->hostname_fd = safe_close(m->hostname_fd); else { - log_error_errno(-r, "Failed to add hostname event source: %m"); + log_error_errno(r, "Failed to add hostname event source: %m"); return r; } } @@ -688,7 +688,7 @@ static void write_resolv_conf_server(DnsServer *s, FILE *f, unsigned *count) { r = in_addr_to_string(s->family, &s->address, &t); if (r < 0) { - log_warning_errno(-r, "Invalid DNS address. Ignoring: %m"); + log_warning_errno(r, "Invalid DNS address. Ignoring: %m"); return; } diff --git a/src/resolve/resolved.c b/src/resolve/resolved.c index 9150a5e33b..c0ab947c0e 100644 --- a/src/resolve/resolved.c +++ b/src/resolve/resolved.c @@ -49,20 +49,20 @@ int main(int argc, char *argv[]) { r = mac_selinux_init(NULL); if (r < 0) { - log_error_errno(-r, "SELinux setup failed: %m"); + log_error_errno(r, "SELinux setup failed: %m"); goto finish; } r = get_user_creds(&user, &uid, &gid, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Cannot resolve user name %s: %m", user); + log_error_errno(r, "Cannot resolve user name %s: %m", user); goto finish; } /* Always create the directory where resolv.conf will live */ r = mkdir_safe_label("/run/systemd/resolve", 0755, uid, gid); if (r < 0) { - log_error_errno(-r, "Could not create runtime directory: %m"); + log_error_errno(r, "Could not create runtime directory: %m"); goto finish; } @@ -74,17 +74,17 @@ int main(int argc, char *argv[]) { r = manager_new(&m); if (r < 0) { - log_error_errno(-r, "Could not create manager: %m"); + log_error_errno(r, "Could not create manager: %m"); goto finish; } r = manager_parse_config_file(m); if (r < 0) - log_warning_errno(-r, "Failed to parse configuration file: %m"); + log_warning_errno(r, "Failed to parse configuration file: %m"); r = manager_start(m); if (r < 0) { - log_error_errno(-r, "Failed to start manager: %m"); + log_error_errno(r, "Failed to start manager: %m"); goto finish; } @@ -92,7 +92,7 @@ int main(int argc, char *argv[]) { * symlink */ r = manager_write_resolv_conf(m); if (r < 0) - log_warning_errno(-r, "Could not create resolv.conf: %m"); + log_warning_errno(r, "Could not create resolv.conf: %m"); sd_notify(false, "READY=1\n" @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) { r = sd_event_loop(m->event); if (r < 0) { - log_error_errno(-r, "Event loop failed: %m"); + log_error_errno(r, "Event loop failed: %m"); goto finish; } diff --git a/src/rfkill/rfkill.c b/src/rfkill/rfkill.c index 0acb092418..c75d6a60d8 100644 --- a/src/rfkill/rfkill.c +++ b/src/rfkill/rfkill.c @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) { r = mkdir_p("/var/lib/systemd/rfkill", 0755); if (r < 0) { - log_error_errno(-r, "Failed to create rfkill directory: %m"); + log_error_errno(r, "Failed to create rfkill directory: %m"); return EXIT_FAILURE; } @@ -107,13 +107,13 @@ int main(int argc, char *argv[]) { if (r == -ENOENT) return EXIT_SUCCESS; - log_error_errno(-r, "Failed to read %s: %m", saved); + log_error_errno(r, "Failed to read %s: %m", saved); return EXIT_FAILURE; } r = udev_device_set_sysattr_value(device, "soft", value); if (r < 0) { - log_error_errno(-r, "Failed to write system attribute: %m"); + log_error_errno(r, "Failed to write system attribute: %m"); return EXIT_FAILURE; } @@ -122,13 +122,13 @@ int main(int argc, char *argv[]) { value = udev_device_get_sysattr_value(device, "soft"); if (!value) { - log_error_errno(-r, "Failed to read system attribute: %m"); + log_error_errno(r, "Failed to read system attribute: %m"); return EXIT_FAILURE; } r = write_string_file(saved, value); if (r < 0) { - log_error_errno(-r, "Failed to write %s: %m", saved); + log_error_errno(r, "Failed to write %s: %m", saved); return EXIT_FAILURE; } diff --git a/src/run/run.c b/src/run/run.c index 14d147c671..ea9454a0e5 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -499,7 +499,7 @@ static int start_transient_scope( r = get_group_creds(&arg_exec_group, &gid); if (r < 0) { - log_error_errno(-r, "Failed to resolve group %s: %m", arg_exec_group); + log_error_errno(r, "Failed to resolve group %s: %m", arg_exec_group); return r; } @@ -516,7 +516,7 @@ static int start_transient_scope( r = get_user_creds(&arg_exec_user, &uid, &gid, &home, &shell); if (r < 0) { - log_error_errno(-r, "Failed to resolve user %s: %m", arg_exec_user); + log_error_errno(r, "Failed to resolve user %s: %m", arg_exec_user); return r; } @@ -595,7 +595,7 @@ int main(int argc, char* argv[]) { r = bus_open_transport_systemd(arg_transport, arg_host, arg_user, &bus); if (r < 0) { - log_error_errno(-r, "Failed to create bus connection: %m"); + log_error_errno(r, "Failed to create bus connection: %m"); goto finish; } diff --git a/src/shared/capability.c b/src/shared/capability.c index f7513379a2..89e61430b0 100644 --- a/src/shared/capability.c +++ b/src/shared/capability.c @@ -255,7 +255,7 @@ int drop_privileges(uid_t uid, gid_t gid, uint64_t keep_capabilities) { r = capability_bounding_set_drop(~keep_capabilities, true); if (r < 0) { - log_error_errno(-r, "Failed to drop capabilities: %m"); + log_error_errno(r, "Failed to drop capabilities: %m"); return r; } diff --git a/src/shared/generator.c b/src/shared/generator.c index 892fa39ec1..f54bb06f68 100644 --- a/src/shared/generator.c +++ b/src/shared/generator.c @@ -52,10 +52,10 @@ int generator_write_fsck_deps( r = fsck_exists(fstype); if (r == -ENOENT) { /* treat missing check as essentially OK */ - log_debug_errno(-r, "Checking was requested for %s, but fsck.%s does not exist: %m", what, fstype); + log_debug_errno(r, "Checking was requested for %s, but fsck.%s does not exist: %m", what, fstype); return 0; } else if (r < 0) { - log_warning_errno(-r, "Checking was requested for %s, but fsck.%s cannot be used: %m", what, fstype); + log_warning_errno(r, "Checking was requested for %s, but fsck.%s cannot be used: %m", what, fstype); return r; } } diff --git a/src/shared/install.c b/src/shared/install.c index 1e90bdf725..9094662dfc 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1554,7 +1554,7 @@ int unit_file_add_dependency( state = unit_file_get_state(scope, root_dir, *i); if (state < 0) { - log_error_errno(-state, "Failed to get unit file state for %s: %m", *i); + log_error_errno(state, "Failed to get unit file state for %s: %m", *i); return state; } diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 32eba6ccfe..eb15eeac88 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -296,7 +296,7 @@ static int output_short( r = sd_journal_get_monotonic_usec(j, &t, &boot_id); if (r < 0) { - log_error_errno(-r, "Failed to get monotonic timestamp: %m"); + log_error_errno(r, "Failed to get monotonic timestamp: %m"); return r; } @@ -323,7 +323,7 @@ static int output_short( r = sd_journal_get_realtime_usec(j, &x); 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; } @@ -422,7 +422,7 @@ static int output_verbose( r = parse_field(data, length, "_SOURCE_REALTIME_TIMESTAMP=", &value, &size); if (r < 0) - log_debug_errno(-r, "_SOURCE_REALTIME_TIMESTAMP invalid: %m"); + log_debug_errno(r, "_SOURCE_REALTIME_TIMESTAMP invalid: %m"); else { r = safe_atou64(value, &realtime); if (r < 0) @@ -442,7 +442,7 @@ static int output_verbose( r = sd_journal_get_cursor(j, &cursor); if (r < 0) { - log_error_errno(-r, "Failed to get cursor: %m"); + log_error_errno(r, "Failed to get cursor: %m"); return r; } @@ -517,19 +517,19 @@ static int output_export( r = sd_journal_get_realtime_usec(j, &realtime); 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; } r = sd_journal_get_monotonic_usec(j, &monotonic, &boot_id); if (r < 0) { - log_error_errno(-r, "Failed to get monotonic timestamp: %m"); + log_error_errno(r, "Failed to get monotonic timestamp: %m"); return r; } r = sd_journal_get_cursor(j, &cursor); if (r < 0) { - log_error_errno(-r, "Failed to get cursor: %m"); + log_error_errno(r, "Failed to get cursor: %m"); return r; } @@ -657,19 +657,19 @@ static int output_json( r = sd_journal_get_realtime_usec(j, &realtime); 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; } r = sd_journal_get_monotonic_usec(j, &monotonic, &boot_id); if (r < 0) { - log_error_errno(-r, "Failed to get monotonic timestamp: %m"); + log_error_errno(r, "Failed to get monotonic timestamp: %m"); return r; } r = sd_journal_get_cursor(j, &cursor); if (r < 0) { - log_error_errno(-r, "Failed to get cursor: %m"); + log_error_errno(r, "Failed to get cursor: %m"); return r; } @@ -877,7 +877,7 @@ static int output_cat( if (r == -ENOENT) return 0; - log_error_errno(-r, "Failed to get data: %m"); + log_error_errno(r, "Failed to get data: %m"); return r; } @@ -1226,13 +1226,13 @@ int add_match_this_boot(sd_journal *j, const char *machine) { if (machine) { r = get_boot_id_for_machine(machine, &boot_id); if (r < 0) { - log_error_errno(-r, "Failed to get boot id of container %s: %m", machine); + log_error_errno(r, "Failed to get boot id of container %s: %m", machine); return r; } } else { r = sd_id128_get_boot(&boot_id); 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; } } @@ -1240,7 +1240,7 @@ int add_match_this_boot(sd_journal *j, const char *machine) { sd_id128_to_string(boot_id, match + 9); 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; } diff --git a/src/shared/pager.c b/src/shared/pager.c index 572c26b149..aa74bab103 100644 --- a/src/shared/pager.c +++ b/src/shared/pager.c @@ -186,7 +186,7 @@ int show_man_page(const char *desc, bool null_stdio) { if (null_stdio) { r = make_null_stdio(); if (r < 0) { - log_error_errno(-r, "Failed to kill stdio: %m"); + log_error_errno(r, "Failed to kill stdio: %m"); _exit(EXIT_FAILURE); } } diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index 7a4e5cda2b..e6157f0e94 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -227,7 +227,7 @@ static bool enough_memory_for_hibernation(void) { r = get_status_field("/proc/meminfo", "\nActive(anon):", &active); if (r < 0) { - log_error_errno(-r, "Failed to retrieve Active(anon) from /proc/meminfo: %m"); + log_error_errno(r, "Failed to retrieve Active(anon) from /proc/meminfo: %m"); return false; } diff --git a/src/shared/socket-label.c b/src/shared/socket-label.c index b0fca9b45c..7a03ac0c51 100644 --- a/src/shared/socket-label.c +++ b/src/shared/socket-label.c @@ -162,12 +162,12 @@ int make_socket_fd(int log_level, const char* address, int flags) { r = socket_address_print(&a, &p); if (r < 0) { - log_error_errno(-r, "socket_address_print(): %m"); + log_error_errno(r, "socket_address_print(): %m"); return r; } if (fd < 0) - log_error_errno(-fd, "Failed to listen on %s: %m", p); + log_error_errno(fd, "Failed to listen on %s: %m", p); else log_full(log_level, "Listening on %s", p); } diff --git a/src/shared/socket-util.c b/src/shared/socket-util.c index 4457e9d1a2..6ef68fce09 100644 --- a/src/shared/socket-util.c +++ b/src/shared/socket-util.c @@ -637,7 +637,7 @@ int socknameinfo_pretty(union sockaddr_union *sa, socklen_t salen, char **_ret) r = sockaddr_pretty(&sa->sa, salen, true, &ret); if (r < 0) { - log_error_errno(-r, "sockadd_pretty() failed: %m"); + log_error_errno(r, "sockadd_pretty() failed: %m"); return r; } diff --git a/src/shared/spawn-ask-password-agent.c b/src/shared/spawn-ask-password-agent.c index 6e31d8d138..ee267833e6 100644 --- a/src/shared/spawn-ask-password-agent.c +++ b/src/shared/spawn-ask-password-agent.c @@ -49,7 +49,7 @@ int ask_password_agent_open(void) { SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH, SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH, "--watch", NULL); if (r < 0) - log_error_errno(-r, "Failed to fork TTY ask password agent: %m"); + log_error_errno(r, "Failed to fork TTY ask password agent: %m"); return r; } diff --git a/src/shared/spawn-polkit-agent.c b/src/shared/spawn-polkit-agent.c index 93652f052d..e7419b5ee4 100644 --- a/src/shared/spawn-polkit-agent.c +++ b/src/shared/spawn-polkit-agent.c @@ -64,7 +64,7 @@ int polkit_agent_open(void) { safe_close(pipe_fd[1]); if (r < 0) - log_error_errno(-r, "Failed to fork TTY ask password agent: %m"); + log_error_errno(r, "Failed to fork TTY ask password agent: %m"); else /* Wait until the agent closes the fd */ fd_wait_for_event(pipe_fd[0], POLLHUP, USEC_INFINITY); diff --git a/src/shared/util.c b/src/shared/util.c index 11be757c2f..646787cd79 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -2214,7 +2214,7 @@ int acquire_terminal( r = reset_terminal_fd(fd, true); if (r < 0) - log_warning_errno(-r, "Failed to reset terminal: %m"); + log_warning_errno(r, "Failed to reset terminal: %m"); return fd; @@ -3796,7 +3796,7 @@ int wait_for_terminate_and_warn(const char *name, pid_t pid) { r = wait_for_terminate(pid, &status); if (r < 0) { - log_warning_errno(-r, "Failed to wait for %s: %m", name); + log_warning_errno(r, "Failed to wait for %s: %m", name); return r; } @@ -5507,13 +5507,13 @@ int make_console_stdio(void) { fd = acquire_terminal("/dev/console", false, true, true, USEC_INFINITY); if (fd < 0) { - log_error_errno(-fd, "Failed to acquire terminal: %m"); + log_error_errno(fd, "Failed to acquire terminal: %m"); return fd; } r = make_stdio(fd); if (r < 0) { - log_error_errno(-r, "Failed to duplicate terminal fd: %m"); + log_error_errno(r, "Failed to duplicate terminal fd: %m"); return r; } diff --git a/src/shutdownd/shutdownd.c b/src/shutdownd/shutdownd.c index c443a90179..5f109f823b 100644 --- a/src/shutdownd/shutdownd.c +++ b/src/shutdownd/shutdownd.c @@ -204,7 +204,7 @@ static int update_schedule_file(struct sd_shutdown_command *c) { r = mkdir_safe_label("/run/systemd/shutdown", 0755, 0, 0); if (r < 0) { - log_error_errno(-r, "Failed to create shutdown subdirectory: %m"); + log_error_errno(r, "Failed to create shutdown subdirectory: %m"); return r; } @@ -214,7 +214,7 @@ static int update_schedule_file(struct sd_shutdown_command *c) { r = fopen_temporary("/run/systemd/shutdown/scheduled", &f, &temp_path); if (r < 0) { - log_error_errno(-r, "Failed to save information about scheduled shutdowns: %m"); + log_error_errno(r, "Failed to save information about scheduled shutdowns: %m"); return r; } @@ -284,7 +284,7 @@ int main(int argc, char *argv[]) { n_fds = sd_listen_fds(true); if (n_fds < 0) { - log_error_errno(-r, "Failed to read listening file descriptors from environment: %m"); + log_error_errno(r, "Failed to read listening file descriptors from environment: %m"); return EXIT_FAILURE; } @@ -410,7 +410,7 @@ int main(int argc, char *argv[]) { e = write_string_file_atomic("/run/nologin", "System is going down."); if (e < 0) - log_error_errno(-e, "Failed to create /run/nologin: %m"); + log_error_errno(e, "Failed to create /run/nologin: %m"); else unlink_nologin = true; diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c index bac7393a5f..d2d7d35015 100644 --- a/src/socket-proxy/socket-proxyd.c +++ b/src/socket-proxy/socket-proxyd.c @@ -266,7 +266,7 @@ static int connection_enable_event_sources(Connection *c) { r = 0; if (r < 0) { - log_error_errno(-r, "Failed to set up server event source: %m"); + log_error_errno(r, "Failed to set up server event source: %m"); return r; } @@ -278,7 +278,7 @@ static int connection_enable_event_sources(Connection *c) { r = 0; if (r < 0) { - log_error_errno(-r, "Failed to set up client event source: %m"); + log_error_errno(r, "Failed to set up client event source: %m"); return r; } @@ -357,13 +357,13 @@ static int connection_start(Connection *c, struct sockaddr *sa, socklen_t salen) if (errno == EINPROGRESS) { r = sd_event_add_io(c->context->event, &c->client_event_source, c->client_fd, EPOLLOUT, connect_cb, c); if (r < 0) { - log_error_errno(-r, "Failed to add connection socket: %m"); + log_error_errno(r, "Failed to add connection socket: %m"); goto fail; } r = sd_event_source_set_enabled(c->client_event_source, SD_EVENT_ONESHOT); if (r < 0) { - log_error_errno(-r, "Failed to enable oneshot event source: %m"); + log_error_errno(r, "Failed to enable oneshot event source: %m"); goto fail; } } else { @@ -449,7 +449,7 @@ static int resolve_remote(Connection *c) { log_debug("Looking up address info for %s:%s", node, service); r = sd_resolve_getaddrinfo(c->context->resolve, &c->resolve_query, node, service, &hints, resolve_cb, c); if (r < 0) { - log_error_errno(-r, "Failed to resolve remote host: %m"); + log_error_errno(r, "Failed to resolve remote host: %m"); goto fail; } @@ -521,14 +521,14 @@ static int accept_cb(sd_event_source *s, int fd, uint32_t revents, void *userdat r = add_connection_socket(context, nfd); if (r < 0) { - log_error_errno(-r, "Failed to accept connection, ignoring: %m"); + log_error_errno(r, "Failed to accept connection, ignoring: %m"); safe_close(fd); } } r = sd_event_source_set_enabled(s, SD_EVENT_ONESHOT); if (r < 0) { - log_error_errno(-r, "Error while re-enabling listener with ONESHOT: %m"); + log_error_errno(r, "Error while re-enabling listener with ONESHOT: %m"); sd_event_exit(context->event, r); return r; } @@ -551,7 +551,7 @@ static int add_listen_socket(Context *context, int fd) { r = sd_is_socket(fd, 0, SOCK_STREAM, 1); if (r < 0) { - log_error_errno(-r, "Failed to determine socket type: %m"); + log_error_errno(r, "Failed to determine socket type: %m"); return r; } if (r == 0) { @@ -561,19 +561,19 @@ static int add_listen_socket(Context *context, int fd) { r = fd_nonblock(fd, true); if (r < 0) { - log_error_errno(-r, "Failed to mark file descriptor non-blocking: %m"); + log_error_errno(r, "Failed to mark file descriptor non-blocking: %m"); return r; } r = sd_event_add_io(context->event, &source, fd, EPOLLIN, accept_cb, context); if (r < 0) { - log_error_errno(-r, "Failed to add event source: %m"); + log_error_errno(r, "Failed to add event source: %m"); return r; } r = set_put(context->listen, source); if (r < 0) { - log_error_errno(-r, "Failed to add source to set: %m"); + log_error_errno(r, "Failed to add source to set: %m"); sd_event_source_unref(source); return r; } @@ -582,7 +582,7 @@ static int add_listen_socket(Context *context, int fd) { * watching to accept(). */ r = sd_event_source_set_enabled(source, SD_EVENT_ONESHOT); if (r < 0) { - log_error_errno(-r, "Failed to enable oneshot mode: %m"); + log_error_errno(r, "Failed to enable oneshot mode: %m"); return r; } @@ -663,19 +663,19 @@ int main(int argc, char *argv[]) { r = sd_event_default(&context.event); if (r < 0) { - log_error_errno(-r, "Failed to allocate event loop: %m"); + log_error_errno(r, "Failed to allocate event loop: %m"); goto finish; } r = sd_resolve_default(&context.resolve); if (r < 0) { - log_error_errno(-r, "Failed to allocate resolver: %m"); + log_error_errno(r, "Failed to allocate resolver: %m"); goto finish; } r = sd_resolve_attach_event(context.resolve, context.event, 0); if (r < 0) { - log_error_errno(-r, "Failed to attach resolver: %m"); + log_error_errno(r, "Failed to attach resolver: %m"); goto finish; } @@ -700,7 +700,7 @@ int main(int argc, char *argv[]) { r = sd_event_loop(context.event); 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/sysctl/sysctl.c b/src/sysctl/sysctl.c index 2f73c32049..346ff3b237 100644 --- a/src/sysctl/sysctl.c +++ b/src/sysctl/sysctl.c @@ -134,7 +134,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno if (ignore_enoent && r == -ENOENT) return 0; - log_error_errno(-r, "Failed to open file '%s', ignoring: %m", path); + log_error_errno(r, "Failed to open file '%s', ignoring: %m", path); return r; } @@ -196,7 +196,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno k = hashmap_put(sysctl_options, property, new_value); if (k < 0) { - log_error_errno(-k, "Failed to add sysctl variable %s to hashmap: %m", property); + log_error_errno(k, "Failed to add sysctl variable %s to hashmap: %m", property); free(property); free(new_value); return k; @@ -314,7 +314,7 @@ int main(int argc, char *argv[]) { r = conf_files_list_nulstr(&files, ".conf", NULL, conf_file_dirs); if (r < 0) { - log_error_errno(-r, "Failed to enumerate sysctl.d files: %m"); + log_error_errno(r, "Failed to enumerate sysctl.d files: %m"); goto finish; } diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 4d1a660e82..4299429fbd 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -622,7 +622,7 @@ static int get_unit_list_recursive( r = sd_bus_open_system_container(&container, *i); if (r < 0) { - log_error_errno(-r, "Failed to connect to container %s: %m", *i); + log_error_errno(r, "Failed to connect to container %s: %m", *i); continue; } @@ -1360,7 +1360,7 @@ static int list_unit_files(sd_bus *bus, char **args) { r = unit_file_get_list(arg_scope, arg_root, h); if (r < 0) { unit_file_list_free(h); - log_error_errno(-r, "Failed to get unit file list: %m"); + log_error_errno(r, "Failed to get unit file list: %m"); return r; } @@ -1907,7 +1907,7 @@ static int get_default(sd_bus *bus, char **args) { if (!bus || avoid_bus()) { r = unit_file_get_default(arg_scope, arg_root, &_path); if (r < 0) { - log_error_errno(-r, "Failed to get default target: %m"); + log_error_errno(r, "Failed to get default target: %m"); return r; } path = _path; @@ -1990,7 +1990,7 @@ static int set_default(sd_bus *bus, char **args) { if (!bus || avoid_bus()) { r = unit_file_set_default(arg_scope, arg_root, unit, true, &changes, &n_changes); if (r < 0) { - log_error_errno(-r, "Failed to set default target: %m"); + log_error_errno(r, "Failed to set default target: %m"); return r; } @@ -2201,7 +2201,7 @@ static int cancel_job(sd_bus *bus, char **args) { q = safe_atou32(*name, &id); if (q < 0) { - log_error_errno(-q, "Failed to parse job id \"%s\": %m", *name); + log_error_errno(q, "Failed to parse job id \"%s\": %m", *name); return q; } @@ -2432,7 +2432,7 @@ static int wait_for_jobs(sd_bus *bus, Set *s) { while (!set_isempty(s)) { q = bus_process_wait(bus); if (q < 0) { - log_error_errno(-q, "Failed to wait for response: %m"); + log_error_errno(q, "Failed to wait for response: %m"); return q; } @@ -2561,7 +2561,7 @@ static int check_triggering_units( STRV_FOREACH(i, triggered_by) { r = check_one_unit(bus, *i, "active\0reloading\0", true); if (r < 0) { - log_error_errno(-r, "Failed to check unit: %m"); + log_error_errno(r, "Failed to check unit: %m"); return r; } @@ -2807,13 +2807,13 @@ static int start_unit(sd_bus *bus, char **args) { else { r = expand_names(bus, args + 1, suffix, &names); if (r < 0) - log_error_errno(-r, "Failed to expand names: %m"); + log_error_errno(r, "Failed to expand names: %m"); } if (!arg_no_block) { r = enable_wait_for_jobs(bus); if (r < 0) { - log_error_errno(-r, "Could not watch jobs: %m"); + log_error_errno(r, "Could not watch jobs: %m"); return r; } @@ -3075,7 +3075,7 @@ static int check_unit_generic(sd_bus *bus, int code, const char *good_states, ch r = expand_names(bus, args, NULL, &names); if (r < 0) { - log_error_errno(-r, "Failed to expand names: %m"); + log_error_errno(r, "Failed to expand names: %m"); return r; } @@ -3115,7 +3115,7 @@ static int kill_unit(sd_bus *bus, char **args) { r = expand_names(bus, args + 1, NULL, &names); if (r < 0) - log_error_errno(-r, "Failed to expand names: %m"); + log_error_errno(r, "Failed to expand names: %m"); STRV_FOREACH(name, names) { _cleanup_bus_message_unref_ sd_bus_message *m = NULL; @@ -4439,7 +4439,7 @@ static int show_system_status(sd_bus *bus) { r = bus_map_all_properties(bus, "org.freedesktop.systemd1", "/org/freedesktop/systemd1", machine_info_property_map, &mi); if (r < 0) { - log_error_errno(-r, "Failed to read server status: %m"); + log_error_errno(r, "Failed to read server status: %m"); return r; } @@ -4558,7 +4558,7 @@ static int show(sd_bus *bus, char **args) { r = expand_names(bus, patterns, NULL, &names); if (r < 0) - log_error_errno(-r, "Failed to expand names: %m"); + log_error_errno(r, "Failed to expand names: %m"); STRV_FOREACH(name, names) { _cleanup_free_ char *unit; @@ -4594,7 +4594,7 @@ static int cat(sd_bus *bus, char **args) { r = expand_names(bus, args + 1, NULL, &names); if (r < 0) - log_error_errno(-r, "Failed to expand names: %m"); + log_error_errno(r, "Failed to expand names: %m"); pager_open_if_enabled(); @@ -4652,7 +4652,7 @@ static int cat(sd_bus *bus, char **args) { r = copy_file_fd(fragment_path, STDOUT_FILENO); if (r < 0) { - log_warning_errno(-r, "Failed to cat %s: %m", fragment_path); + log_warning_errno(r, "Failed to cat %s: %m", fragment_path); continue; } } @@ -4667,7 +4667,7 @@ static int cat(sd_bus *bus, char **args) { r = copy_file_fd(*path, STDOUT_FILENO); if (r < 0) { - log_warning_errno(-r, "Failed to cat %s: %m", *path); + log_warning_errno(r, "Failed to cat %s: %m", *path); continue; } } @@ -4807,7 +4807,7 @@ static int delete_snapshot(sd_bus *bus, char **args) { r = expand_names(bus, args + 1, ".snapshot", &names); if (r < 0) - log_error_errno(-r, "Failed to expand names: %m"); + log_error_errno(r, "Failed to expand names: %m"); STRV_FOREACH(name, names) { _cleanup_bus_message_unref_ sd_bus_message *m = NULL; @@ -4908,7 +4908,7 @@ static int reset_failed(sd_bus *bus, char **args) { r = expand_names(bus, args + 1, NULL, &names); if (r < 0) - log_error_errno(-r, "Failed to expand names: %m"); + log_error_errno(r, "Failed to expand names: %m"); STRV_FOREACH(name, names) { _cleanup_bus_message_unref_ sd_bus_message *m = NULL; @@ -5002,7 +5002,7 @@ static int switch_root(sd_bus *bus, char **args) { "init", &cmdline_init, NULL); if (r < 0) - log_debug_errno(-r, "Failed to parse /proc/cmdline: %m"); + log_debug_errno(r, "Failed to parse /proc/cmdline: %m"); init = cmdline_init; } @@ -5247,7 +5247,7 @@ static int enable_sysv_units(const char *verb, char **args) { j = wait_for_terminate(pid, &status); if (j < 0) { - log_error_errno(-r, "Failed to wait for child: %m"); + log_error_errno(r, "Failed to wait for child: %m"); return j; } @@ -5361,7 +5361,7 @@ static int enable_unit(sd_bus *bus, char **args) { assert_not_reached("Unknown verb"); if (r < 0) { - log_error_errno(-r, "Operation failed: %m"); + log_error_errno(r, "Operation failed: %m"); goto finish; } @@ -5510,7 +5510,7 @@ static int add_dependency(sd_bus *bus, char **args) { r = unit_file_add_dependency(arg_scope, arg_runtime, arg_root, names, target, dep, arg_force, &changes, &n_changes); if (r < 0) { - log_error_errno(-r, "Can't add dependency: %m"); + log_error_errno(r, "Can't add dependency: %m"); return r; } @@ -5573,7 +5573,7 @@ static int preset_all(sd_bus *bus, char **args) { r = unit_file_preset_all(arg_scope, arg_runtime, arg_root, arg_preset_mode, arg_force, &changes, &n_changes); if (r < 0) { - log_error_errno(-r, "Operation failed: %m"); + log_error_errno(r, "Operation failed: %m"); goto finish; } @@ -5656,7 +5656,7 @@ static int unit_is_enabled(sd_bus *bus, char **args) { state = unit_file_get_state(arg_scope, arg_root, *name); if (state < 0) { - log_error_errno(-state, "Failed to get unit file state for %s: %m", *name); + log_error_errno(state, "Failed to get unit file state for %s: %m", *name); return state; } @@ -6897,7 +6897,7 @@ found: * enable/disable */ if (verb->bus == NOBUS) { if (!bus && !avoid_bus()) { - log_error_errno(-bus_error, "Failed to get D-Bus connection: %m"); + log_error_errno(bus_error, "Failed to get D-Bus connection: %m"); return -EIO; } @@ -6908,7 +6908,7 @@ found: } if ((verb->bus != FORCE || arg_force <= 0) && !bus) { - log_error_errno(-bus_error, "Failed to get D-Bus connection: %m"); + log_error_errno(bus_error, "Failed to get D-Bus connection: %m"); return -EIO; } } @@ -7086,7 +7086,7 @@ static int halt_main(sd_bus *bus) { m); if (r < 0) - log_warning_errno(-r, "Failed to talk to shutdownd, proceeding with immediate shutdown: %m"); + log_warning_errno(r, "Failed to talk to shutdownd, proceeding with immediate shutdown: %m"); else { char date[FORMAT_TIMESTAMP_MAX]; @@ -7105,7 +7105,7 @@ static int halt_main(sd_bus *bus) { else { r = utmp_put_shutdown(); if (r < 0) - log_warning_errno(-r, "Failed to write utmp record: %m"); + log_warning_errno(r, "Failed to write utmp record: %m"); } } @@ -7113,7 +7113,7 @@ static int halt_main(sd_bus *bus) { return 0; r = halt_now(arg_action); - log_error_errno(-r, "Failed to reboot: %m"); + log_error_errno(r, "Failed to reboot: %m"); return r; } @@ -7211,7 +7211,7 @@ int main(int argc, char*argv[]) { r = send_shutdownd(arg_when, SD_SHUTDOWN_NONE, false, !arg_no_wall, m); if (r < 0) - log_warning_errno(-r, "Failed to talk to shutdownd, shutdown hasn't been cancelled: %m"); + log_warning_errno(r, "Failed to talk to shutdownd, shutdown hasn't been cancelled: %m"); break; } diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index 89a44f413c..8811102906 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -920,7 +920,7 @@ static int add_user(Item *i) { if (i->uid_set) { r = uid_is_ok(i->uid, i->name); if (r < 0) { - log_error_errno(-r, "Failed to verify uid " UID_FMT ": %m", i->uid); + log_error_errno(r, "Failed to verify uid " UID_FMT ": %m", i->uid); return r; } if (r == 0) { @@ -940,7 +940,7 @@ static int add_user(Item *i) { else { r = uid_is_ok(c, i->name); if (r < 0) { - log_error_errno(-r, "Failed to verify uid " UID_FMT ": %m", i->uid); + log_error_errno(r, "Failed to verify uid " UID_FMT ": %m", i->uid); return r; } else if (r > 0) { i->uid = c; @@ -955,7 +955,7 @@ static int add_user(Item *i) { if (!i->uid_set && i->gid_set) { r = uid_is_ok((uid_t) i->gid, i->name); if (r < 0) { - log_error_errno(-r, "Failed to verify uid " UID_FMT ": %m", i->uid); + log_error_errno(r, "Failed to verify uid " UID_FMT ": %m", i->uid); return r; } if (r > 0) { @@ -975,7 +975,7 @@ static int add_user(Item *i) { r = uid_is_ok(search_uid, i->name); if (r < 0) { - log_error_errno(-r, "Failed to verify uid " UID_FMT ": %m", i->uid); + log_error_errno(r, "Failed to verify uid " UID_FMT ": %m", i->uid); return r; } else if (r > 0) break; @@ -1072,7 +1072,7 @@ static int add_group(Item *i) { if (i->gid_set) { r = gid_is_ok(i->gid); if (r < 0) { - log_error_errno(-r, "Failed to verify gid " GID_FMT ": %m", i->gid); + log_error_errno(r, "Failed to verify gid " GID_FMT ": %m", i->gid); return r; } if (r == 0) { @@ -1085,7 +1085,7 @@ static int add_group(Item *i) { if (!i->gid_set && i->uid_set) { r = gid_is_ok((gid_t) i->uid); if (r < 0) { - log_error_errno(-r, "Failed to verify gid " GID_FMT ": %m", i->gid); + log_error_errno(r, "Failed to verify gid " GID_FMT ": %m", i->gid); return r; } if (r > 0) { @@ -1105,7 +1105,7 @@ static int add_group(Item *i) { else { r = gid_is_ok(c); if (r < 0) { - log_error_errno(-r, "Failed to verify gid " GID_FMT ": %m", i->gid); + log_error_errno(r, "Failed to verify gid " GID_FMT ": %m", i->gid); return r; } else if (r > 0) { i->gid = c; @@ -1128,7 +1128,7 @@ static int add_group(Item *i) { r = gid_is_ok(search_uid); if (r < 0) { - log_error_errno(-r, "Failed to verify gid " GID_FMT ": %m", i->gid); + log_error_errno(r, "Failed to verify gid " GID_FMT ": %m", i->gid); return r; } else if (r > 0) break; @@ -1721,7 +1721,7 @@ static int read_config_file(const char *fn, bool ignore_enoent) { if (ignore_enoent && r == -ENOENT) return 0; - log_error_errno(-r, "Failed to open '%s', ignoring: %m", fn); + log_error_errno(r, "Failed to open '%s', ignoring: %m", fn); return r; } @@ -1853,7 +1853,7 @@ int main(int argc, char *argv[]) { r = mac_selinux_init(NULL); if (r < 0) { - log_error_errno(-r, "SELinux setup failed: %m"); + log_error_errno(r, "SELinux setup failed: %m"); goto finish; } @@ -1871,7 +1871,7 @@ int main(int argc, char *argv[]) { r = conf_files_list_nulstr(&files, ".conf", arg_root, conf_file_dirs); if (r < 0) { - log_error_errno(-r, "Failed to enumerate sysusers.d files: %m"); + log_error_errno(r, "Failed to enumerate sysusers.d files: %m"); goto finish; } @@ -1897,19 +1897,19 @@ int main(int argc, char *argv[]) { lock = take_password_lock(arg_root); if (lock < 0) { - log_error_errno(-lock, "Failed to take lock: %m"); + log_error_errno(lock, "Failed to take lock: %m"); goto finish; } r = load_user_database(); if (r < 0) { - log_error_errno(-r, "Failed to load user database: %m"); + log_error_errno(r, "Failed to load user database: %m"); goto finish; } r = load_group_database(); if (r < 0) { - log_error_errno(-r, "Failed to read group database: %m"); + log_error_errno(r, "Failed to read group database: %m"); goto finish; } @@ -1921,7 +1921,7 @@ int main(int argc, char *argv[]) { r = write_files(); if (r < 0) - log_error_errno(-r, "Failed to write files: %m"); + log_error_errno(r, "Failed to write files: %m"); finish: while ((i = hashmap_steal_first(groups))) diff --git a/src/test/test-boot-timestamps.c b/src/test/test-boot-timestamps.c index 354307cba1..06d93af533 100644 --- a/src/test/test-boot-timestamps.c +++ b/src/test/test-boot-timestamps.c @@ -37,7 +37,7 @@ static int test_acpi_fpdt(void) { r = acpi_get_boot_usec(&loader_start, &loader_exit); if (r < 0) { if (r != -ENOENT) - log_error_errno(-r, "Failed to read ACPI FPDT: %m"); + log_error_errno(r, "Failed to read ACPI FPDT: %m"); return r; } @@ -60,7 +60,7 @@ static int test_efi_loader(void) { r = efi_loader_get_boot_usec(&loader_start, &loader_exit); if (r < 0) { if (r != -ENOENT) - log_error_errno(-r, "Failed to read EFI loader data: %m"); + log_error_errno(r, "Failed to read EFI loader data: %m"); return r; } @@ -84,7 +84,7 @@ int main(int argc, char* argv[]) { r = boot_timestamps(NULL, &fw, &l); if (r < 0) { - log_error_errno(-r, "Failed to read variables: %m"); + log_error_errno(r, "Failed to read variables: %m"); return 1; } diff --git a/src/test/test-hostname.c b/src/test/test-hostname.c index 1bc4126590..86efa1a3f7 100644 --- a/src/test/test-hostname.c +++ b/src/test/test-hostname.c @@ -32,7 +32,7 @@ int main(int argc, char* argv[]) { r = hostname_setup(); if (r < 0) - log_error_errno(-r, "hostname: %m"); + log_error_errno(r, "hostname: %m"); return 0; } diff --git a/src/test/test-ns.c b/src/test/test-ns.c index fa297f9183..e66d97ff33 100644 --- a/src/test/test-ns.c +++ b/src/test/test-ns.c @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) { PROTECT_SYSTEM_NO, 0); if (r < 0) { - log_error_errno(-r, "Failed to setup namespace: %m"); + log_error_errno(r, "Failed to setup namespace: %m"); return 1; } diff --git a/src/test/test-socket-util.c b/src/test/test-socket-util.c index d268423cc4..6fb4a40944 100644 --- a/src/test/test-socket-util.c +++ b/src/test/test-socket-util.c @@ -258,7 +258,7 @@ static void test_nameinfo_pretty(void) { _cleanup_close_ int sfd = -1, cfd = -1; r = getnameinfo_pretty(STDIN_FILENO, &stdin_name); - log_info_errno(-r, "No connection remote: %m"); + log_info_errno(r, "No connection remote: %m"); assert_se(r < 0); diff --git a/src/test/test-watchdog.c b/src/test/test-watchdog.c index 72e0c03dd7..f6bb045c3c 100644 --- a/src/test/test-watchdog.c +++ b/src/test/test-watchdog.c @@ -35,13 +35,13 @@ int main(int argc, char *argv[]) { r = watchdog_set_timeout(&t); if (r < 0) - log_warning_errno(-r, "Failed to open watchdog: %m"); + log_warning_errno(r, "Failed to open watchdog: %m"); for (i = 0; i < 5; i++) { log_info("Pinging..."); r = watchdog_ping(); if (r < 0) - log_warning_errno(-r, "Failed to ping watchdog: %m"); + log_warning_errno(r, "Failed to ping watchdog: %m"); usleep(t/2); } diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c index f8d2af97d4..65cae0bd69 100644 --- a/src/timedate/timedatectl.c +++ b/src/timedate/timedatectl.c @@ -232,7 +232,7 @@ static int show_status(sd_bus *bus, char **args, unsigned n) { map, &info); if (r < 0) { - log_error_errno(-r, "Failed to query server: %m"); + log_error_errno(r, "Failed to query server: %m"); goto fail; } @@ -364,7 +364,7 @@ static int list_timezones(sd_bus *bus, char **args, unsigned n) { r = get_timezones(&zones); if (r < 0) { - log_error_errno(-r, "Failed to read list of time zones: %m"); + log_error_errno(r, "Failed to read list of time zones: %m"); return r; } @@ -558,7 +558,7 @@ int main(int argc, char *argv[]) { r = bus_open_transport(arg_transport, arg_host, false, &bus); if (r < 0) { - log_error_errno(-r, "Failed to create bus connection: %m"); + log_error_errno(r, "Failed to create bus connection: %m"); goto finish; } diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c index 5391f5b18f..867b29412c 100644 --- a/src/timedate/timedated.c +++ b/src/timedate/timedated.c @@ -74,7 +74,7 @@ static int context_read_data(Context *c) { if (r == -EINVAL) log_warning("/etc/localtime should be a symbolic link to a time zone data file in /usr/share/zoneinfo/."); else - log_warning_errno(-r, "Failed to get target of /etc/localtime: %m"); + log_warning_errno(r, "Failed to get target of /etc/localtime: %m"); } else { const char *e; @@ -411,7 +411,7 @@ static int method_set_timezone(sd_bus *bus, sd_bus_message *m, void *userdata, s /* 1. Write new configuration file */ r = context_write_data_timezone(c); if (r < 0) { - log_error_errno(-r, "Failed to set time zone: %m"); + log_error_errno(r, "Failed to set time zone: %m"); return sd_bus_error_set_errnof(error, r, "Failed to set time zone: %s", strerror(-r)); } @@ -467,7 +467,7 @@ static int method_set_local_rtc(sd_bus *bus, sd_bus_message *m, void *userdata, /* 1. Write new configuration file */ r = context_write_data_local_rtc(c); if (r < 0) { - log_error_errno(-r, "Failed to set RTC to local/UTC: %m"); + log_error_errno(r, "Failed to set RTC to local/UTC: %m"); return sd_bus_error_set_errnof(error, r, "Failed to set RTC to local/UTC: %s", strerror(-r)); } @@ -650,25 +650,25 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) { r = sd_bus_default_system(&bus); if (r < 0) { - log_error_errno(-r, "Failed to get system bus connection: %m"); + log_error_errno(r, "Failed to get system bus connection: %m"); return r; } r = sd_bus_add_object_vtable(bus, NULL, "/org/freedesktop/timedate1", "org.freedesktop.timedate1", timedate_vtable, c); if (r < 0) { - log_error_errno(-r, "Failed to register object: %m"); + log_error_errno(r, "Failed to register object: %m"); return r; } r = sd_bus_request_name(bus, "org.freedesktop.timedate1", 0); if (r < 0) { - log_error_errno(-r, "Failed to register name: %m"); + log_error_errno(r, "Failed to register name: %m"); return r; } r = sd_bus_attach_event(bus, event, 0); if (r < 0) { - log_error_errno(-r, "Failed to attach bus to event loop: %m"); + log_error_errno(r, "Failed to attach bus to event loop: %m"); return r; } @@ -698,7 +698,7 @@ int main(int argc, char *argv[]) { r = sd_event_default(&event); if (r < 0) { - log_error_errno(-r, "Failed to allocate event loop: %m"); + log_error_errno(r, "Failed to allocate event loop: %m"); goto finish; } @@ -710,19 +710,19 @@ int main(int argc, char *argv[]) { r = context_read_data(&context); if (r < 0) { - log_error_errno(-r, "Failed to read time zone data: %m"); + log_error_errno(r, "Failed to read time zone data: %m"); goto finish; } r = context_read_ntp(&context, bus); if (r < 0) { - log_error_errno(-r, "Failed to determine whether NTP is enabled: %m"); + log_error_errno(r, "Failed to determine whether NTP is enabled: %m"); goto finish; } r = bus_event_loop_with_idle(event, bus, "org.freedesktop.timedate1", DEFAULT_EXIT_USEC, NULL, NULL); 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/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c index f87722ddce..8e4c0f3392 100644 --- a/src/timesync/timesyncd-manager.c +++ b/src/timesync/timesyncd-manager.c @@ -188,7 +188,7 @@ static int manager_send_request(Manager *m) { if (m->server_socket < 0) { r = manager_listen_setup(m); if (r < 0) { - log_warning_errno(-r, "Failed to setup connection socket: %m"); + log_warning_errno(r, "Failed to setup connection socket: %m"); return r; } } @@ -226,7 +226,7 @@ static int manager_send_request(Manager *m) { r = manager_arm_timer(m, m->retry_interval); if (r < 0) { - log_error_errno(-r, "Failed to rearm timer: %m"); + log_error_errno(r, "Failed to rearm timer: %m"); return r; } @@ -239,7 +239,7 @@ static int manager_send_request(Manager *m) { now(clock_boottime_or_monotonic()) + TIMEOUT_USEC, 0, manager_timeout, m); if (r < 0) { - log_error_errno(-r, "Failed to arm timeout timer: %m"); + log_error_errno(r, "Failed to arm timeout timer: %m"); return r; } } @@ -329,7 +329,7 @@ static int manager_clock_watch_setup(Manager *m) { r = sd_event_add_io(m->event, &m->event_clock_watch, m->clock_watch_fd, EPOLLIN, manager_clock_watch, m); if (r < 0) { - log_error_errno(-r, "Failed to create clock watch event source: %m"); + log_error_errno(r, "Failed to create clock watch event source: %m"); return r; } @@ -699,7 +699,7 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re r = manager_arm_timer(m, m->poll_interval_usec); if (r < 0) { - log_error_errno(-r, "Failed to rearm timer: %m"); + log_error_errno(r, "Failed to rearm timer: %m"); return r; } @@ -827,7 +827,7 @@ static int manager_resolve_handler(sd_resolve_query *q, int ret, const struct ad r = server_address_new(m->current_server_name, &a, (const union sockaddr_union*) ai->ai_addr, ai->ai_addrlen); if (r < 0) { - log_error_errno(-r, "Failed to add server address: %m"); + log_error_errno(r, "Failed to add server address: %m"); return r; } @@ -868,7 +868,7 @@ int manager_connect(Manager *m) { r = sd_event_add_time(m->event, &m->event_retry, clock_boottime_or_monotonic(), now(clock_boottime_or_monotonic()) + RETRY_USEC, 0, manager_retry_connect, m); if (r < 0) { - log_error_errno(-r, "Failed to create retry timer: %m"); + log_error_errno(r, "Failed to create retry timer: %m"); return r; } @@ -924,7 +924,7 @@ int manager_connect(Manager *m) { log_debug("Waiting after exhausting servers."); r = sd_event_add_time(m->event, &m->event_retry, clock_boottime_or_monotonic(), now(clock_boottime_or_monotonic()) + m->poll_interval_usec, 0, manager_retry_connect, m); if (r < 0) { - log_error_errno(-r, "Failed to create retry timer: %m"); + log_error_errno(r, "Failed to create retry timer: %m"); return r; } @@ -953,7 +953,7 @@ int manager_connect(Manager *m) { r = sd_resolve_getaddrinfo(m->resolve, &m->resolve_query, m->current_server_name->string, "123", &hints, manager_resolve_handler, m); if (r < 0) { - log_error_errno(-r, "Failed to create resolver: %m"); + log_error_errno(r, "Failed to create resolver: %m"); return r; } diff --git a/src/timesync/timesyncd.c b/src/timesync/timesyncd.c index b5a521f672..ed02e6db3a 100644 --- a/src/timesync/timesyncd.c +++ b/src/timesync/timesyncd.c @@ -101,7 +101,7 @@ int main(int argc, char *argv[]) { r = get_user_creds(&user, &uid, &gid, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Cannot resolve user name %s: %m", user); + log_error_errno(r, "Cannot resolve user name %s: %m", user); goto finish; } @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) { r = manager_new(&m); if (r < 0) { - log_error_errno(-r, "Failed to allocate manager: %m"); + log_error_errno(r, "Failed to allocate manager: %m"); goto finish; } @@ -129,7 +129,7 @@ int main(int argc, char *argv[]) { r = manager_parse_config_file(m); if (r < 0) - log_warning_errno(-r, "Failed to parse configuration file: %m"); + log_warning_errno(r, "Failed to parse configuration file: %m"); log_debug("systemd-timesyncd running as pid %lu", (unsigned long) getpid()); sd_notify(false, @@ -144,7 +144,7 @@ int main(int argc, char *argv[]) { r = sd_event_loop(m->event); 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/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index c44dcff514..34a644b26b 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -668,7 +668,7 @@ static int create_item(Item *i) { struct stat a, b; if (r != -EEXIST) { - log_error_errno(-r, "Failed to copy files to %s: %m", i->path); + log_error_errno(r, "Failed to copy files to %s: %m", i->path); return -r; } @@ -711,7 +711,7 @@ static int create_item(Item *i) { if (r < 0) { if (r != -EEXIST) { - log_error_errno(-r, "Failed to create directory %s: %m", i->path); + log_error_errno(r, "Failed to create directory %s: %m", i->path); return r; } @@ -762,7 +762,7 @@ static int create_item(Item *i) { } if (r < 0) { - log_error_errno(-r, "Failed to create fifo %s: %m", i->path); + log_error_errno(r, "Failed to create fifo %s: %m", i->path); return r; } } else { @@ -801,7 +801,7 @@ static int create_item(Item *i) { mac_selinux_create_file_clear(); if (r < 0) { - log_error_errno(-r, "symlink(%s, %s) failed: %m", i->argument, i->path); + log_error_errno(r, "symlink(%s, %s) failed: %m", i->argument, i->path); return r; } } else { @@ -863,7 +863,7 @@ static int create_item(Item *i) { } if (r < 0) { - log_error_errno(-r, "Failed to create device node %s: %m", i->path); + log_error_errno(r, "Failed to create device node %s: %m", i->path); return r; } } else { @@ -939,7 +939,7 @@ static int remove_item_instance(Item *i, const char *instance) { * instead of rm_rf() so that 'x' is honoured. */ r = rm_rf_dangerous(instance, false, i->type == RECURSIVE_REMOVE_PATH, false); if (r < 0 && r != -ENOENT) { - log_error_errno(-r, "rm_rf(%s): %m", instance); + log_error_errno(r, "rm_rf(%s): %m", instance); return r; } @@ -1398,7 +1398,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { r = hashmap_put(h, i->path, i); if (r < 0) { - log_error_errno(-r, "Failed to insert item %s: %m", i->path); + log_error_errno(r, "Failed to insert item %s: %m", i->path); return r; } @@ -1531,7 +1531,7 @@ static int read_config_file(const char *fn, bool ignore_enoent) { if (ignore_enoent && r == -ENOENT) return 0; - log_error_errno(-r, "Failed to open '%s', ignoring: %m", fn); + log_error_errno(r, "Failed to open '%s', ignoring: %m", fn); return r; } @@ -1629,7 +1629,7 @@ int main(int argc, char *argv[]) { r = conf_files_list_nulstr(&files, ".conf", arg_root, conf_file_dirs); if (r < 0) { - log_error_errno(-r, "Failed to enumerate tmpfiles.d files: %m"); + log_error_errno(r, "Failed to enumerate tmpfiles.d files: %m"); goto finish; } diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c index 70ad3cb1ac..12b88fbff0 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -339,7 +339,7 @@ static int parse_password(const char *filename, char **wall) { return 0; if (r < 0) { - log_error_errno(-r, "Failed to query password: %m"); + log_error_errno(r, "Failed to query password: %m"); return r; } @@ -504,7 +504,7 @@ static int watch_passwords(void) { for (;;) { r = show_passwords(); if (r < 0) - log_error_errno(-r, "Failed to show password: %m"); + log_error_errno(r, "Failed to show password: %m"); if (poll(pollfd, _FD_MAX, -1) < 0) { if (errno == EINTR) @@ -642,7 +642,7 @@ int main(int argc, char *argv[]) { r = show_passwords(); if (r < 0) - log_error_errno(-r, "Error: %m"); + log_error_errno(r, "Error: %m"); finish: return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; diff --git a/src/udev/net/ethtool-util.c b/src/udev/net/ethtool-util.c index e46d4d3d7c..4608a6c982 100644 --- a/src/udev/net/ethtool-util.c +++ b/src/udev/net/ethtool-util.c @@ -76,7 +76,7 @@ int ethtool_get_driver(int *fd, const char *ifname, char **ret) { if (*fd < 0) { r = ethtool_connect(fd); if (r < 0) { - log_warning_errno(-r, "link_config: could not connect to ethtool: %m"); + log_warning_errno(r, "link_config: could not connect to ethtool: %m"); return r; } } @@ -112,7 +112,7 @@ int ethtool_set_speed(int *fd, const char *ifname, unsigned int speed, Duplex du if (*fd < 0) { r = ethtool_connect(fd); if (r < 0) { - log_warning_errno(-r, "link_config: could not connect to ethtool: %m"); + log_warning_errno(r, "link_config: could not connect to ethtool: %m"); return r; } } @@ -172,7 +172,7 @@ int ethtool_set_wol(int *fd, const char *ifname, WakeOnLan wol) { if (*fd < 0) { r = ethtool_connect(fd); if (r < 0) { - log_warning_errno(-r, "link_config: could not connect to ethtool: %m"); + log_warning_errno(r, "link_config: could not connect to ethtool: %m"); return r; } } diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 97e260baed..7d1bdc9ee7 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -175,7 +175,7 @@ static bool enable_name_policy(void) { 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 true; } @@ -203,7 +203,7 @@ int link_config_load(link_config_ctx *ctx) { r = conf_files_list_strv(&files, ".link", NULL, link_dirs); if (r < 0) { - log_error_errno(-r, "failed to enumerate link files: %m"); + log_error_errno(r, "failed to enumerate link files: %m"); return r; } diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c index 6628ac873f..2deb8b9fbb 100644 --- a/src/udev/udev-builtin-keyboard.c +++ b/src/udev/udev-builtin-keyboard.c @@ -62,7 +62,7 @@ static int install_force_release(struct udev_device *dev, const unsigned int *re log_debug("keyboard: updating force-release list with '%s'", codes); ret = udev_device_set_sysattr_value(atkbd, "force_release", codes); if (ret < 0) - log_error_errno(-ret, "Error writing force-release attribute: %m"); + log_error_errno(ret, "Error writing force-release attribute: %m"); return ret; } diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c index a1934f463e..87d10bf78f 100644 --- a/src/udev/udev-builtin-net_setup_link.c +++ b/src/udev/udev-builtin-net_setup_link.c @@ -46,14 +46,14 @@ static int builtin_net_setup_link(struct udev_device *dev, int argc, char **argv log_debug("No matching link configuration found."); return EXIT_SUCCESS; } else { - log_error_errno(-r, "Could not get link config: %m"); + log_error_errno(r, "Could not get link config: %m"); return EXIT_FAILURE; } } r = link_config_apply(ctx, link, dev, &name); if (r < 0) { - log_error_errno(-r, "Could not apply link config to %s: %m", udev_device_get_sysname(dev)); + log_error_errno(r, "Could not apply link config to %s: %m", udev_device_get_sysname(dev)); return EXIT_FAILURE; } diff --git a/src/udev/udev-builtin-uaccess.c b/src/udev/udev-builtin-uaccess.c index ecd320a588..591915435a 100644 --- a/src/udev/udev-builtin-uaccess.c +++ b/src/udev/udev-builtin-uaccess.c @@ -63,7 +63,7 @@ static int builtin_uaccess(struct udev_device *dev, int argc, char *argv[], bool r = devnode_acl(path, true, false, 0, true, uid); if (r < 0) { - log_error_errno(-r, "Failed to apply ACL on %s: %m", path); + log_error_errno(r, "Failed to apply ACL on %s: %m", path); goto finish; } @@ -77,7 +77,7 @@ finish: /* Better be safe than sorry and reset ACL */ k = devnode_acl(path, true, false, 0, false, 0); if (k < 0) { - log_error_errno(-k, "Failed to apply ACL on %s: %m", path); + log_error_errno(k, "Failed to apply ACL on %s: %m", path); if (r >= 0) r = k; } diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c index d6cc9b493a..2c016da103 100644 --- a/src/udev/udev-ctrl.c +++ b/src/udev/udev-ctrl.c @@ -194,7 +194,7 @@ struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) { /* check peer credential of connection */ r = getpeercred(conn->sock, &ucred); if (r < 0) { - log_error_errno(-r, "unable to receive credentials of ctrl connection: %m"); + log_error_errno(r, "unable to receive credentials of ctrl connection: %m"); goto err; } if (ucred.uid > 0) { diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c index f105fa28e2..c9a273d003 100644 --- a/src/udev/udev-node.c +++ b/src/udev/udev-node.c @@ -304,7 +304,7 @@ static int node_permissions_apply(struct udev_device *dev, bool apply, r = mac_selinux_apply(devnode, label); if (r < 0) - log_error_errno(-r, "SECLABEL: failed to set SELinux label '%s': %m", label); + log_error_errno(r, "SECLABEL: failed to set SELinux label '%s': %m", label); else log_debug("SECLABEL: set SELinux label '%s'", label); @@ -313,7 +313,7 @@ static int node_permissions_apply(struct udev_device *dev, bool apply, r = mac_smack_apply(devnode, label); if (r < 0) - log_error_errno(-r, "SECLABEL: failed to set SMACK label '%s': %m", label); + log_error_errno(r, "SECLABEL: failed to set SMACK label '%s': %m", label); else log_debug("SECLABEL: set SMACK label '%s'", label); diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index 07c1f11033..eb56e270c1 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -1685,7 +1685,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) { r = conf_files_list_strv(&files, ".rules", NULL, rules_dirs); if (r < 0) { - log_error_errno(-r, "failed to enumerate rules files: %m"); + log_error_errno(r, "failed to enumerate rules files: %m"); return udev_rules_unref(rules); } @@ -2653,7 +2653,7 @@ int udev_rules_apply_static_dev_perms(struct udev_rules *rules) { strscpyl(tags_dir, sizeof(tags_dir), "/run/udev/static_node-tags/", *t, "/", NULL); r = mkdir_p(tags_dir, 0755); if (r < 0) { - log_error_errno(-r, "failed to create %s: %m", tags_dir); + log_error_errno(r, "failed to create %s: %m", tags_dir); return r; } diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c index 9a32fa8c6f..fa137c1cc2 100644 --- a/src/udev/udevadm-hwdb.c +++ b/src/udev/udevadm-hwdb.c @@ -618,7 +618,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) { err = conf_files_list_strv(&files, ".hwdb", root, conf_file_dirs); if (err < 0) { - log_error_errno(-err, "failed to enumerate hwdb files: %m"); + log_error_errno(err, "failed to enumerate hwdb files: %m"); rc = EXIT_FAILURE; goto out; } @@ -652,7 +652,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) { mkdir_parents(hwdb_bin, 0755); err = trie_store(trie, hwdb_bin); if (err < 0) { - log_error_errno(-err, "Failure writing database %s: %m", hwdb_bin); + log_error_errno(err, "Failure writing database %s: %m", hwdb_bin); rc = EXIT_FAILURE; } } diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 99b033b050..d1cc7788bc 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -962,7 +962,7 @@ static void kernel_cmdline_options(struct udev *udev) { 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; } @@ -1135,7 +1135,7 @@ int main(int argc, char *argv[]) { r = mac_selinux_init("/dev"); if (r < 0) { - log_error_errno(-r, "could not initialize labelling: %m"); + log_error_errno(r, "could not initialize labelling: %m"); goto exit; } @@ -1239,7 +1239,7 @@ int main(int argc, char *argv[]) { rc = udev_rules_apply_static_dev_perms(rules); if (rc < 0) - log_error_errno(-rc, "failed to apply permissions on static device nodes - %m"); + log_error_errno(rc, "failed to apply permissions on static device nodes - %m"); if (arg_daemonize) { pid_t pid; diff --git a/src/update-done/update-done.c b/src/update-done/update-done.c index 07e87b0c08..44d9df7528 100644 --- a/src/update-done/update-done.c +++ b/src/update-done/update-done.c @@ -114,7 +114,7 @@ int main(int argc, char *argv[]) { r = mac_selinux_init(NULL); if (r < 0) { - log_error_errno(-r, "SELinux setup failed: %m"); + log_error_errno(r, "SELinux setup failed: %m"); goto finish; } diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c index a5dd8a9236..1d7bebeb41 100644 --- a/src/update-utmp/update-utmp.c +++ b/src/update-utmp/update-utmp.c @@ -144,7 +144,7 @@ static int on_reboot(Context *c) { q = utmp_put_reboot(t); if (q < 0) { - log_error_errno(-q, "Failed to write utmp record: %m"); + log_error_errno(q, "Failed to write utmp record: %m"); r = q; } @@ -170,7 +170,7 @@ static int on_shutdown(Context *c) { q = utmp_put_shutdown(); if (q < 0) { - log_error_errno(-q, "Failed to write utmp record: %m"); + log_error_errno(q, "Failed to write utmp record: %m"); r = q; } @@ -190,7 +190,7 @@ static int on_runlevel(Context *c) { if (q < 0) { if (q != -ESRCH && q != -ENOENT) { - log_error_errno(-q, "Failed to get current runlevel: %m"); + log_error_errno(q, "Failed to get current runlevel: %m"); return q; } @@ -225,7 +225,7 @@ static int on_runlevel(Context *c) { q = utmp_put_runlevel(runlevel, previous); if (q < 0 && q != -ESRCH && q != -ENOENT) { - log_error_errno(-q, "Failed to write utmp record: %m"); + log_error_errno(q, "Failed to write utmp record: %m"); r = q; } @@ -265,7 +265,7 @@ int main(int argc, char *argv[]) { #endif r = bus_open_system_systemd(&c.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"); r = -EIO; goto finish; } diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c index e2ba8a0138..5bd0b9b143 100644 --- a/src/vconsole/vconsole-setup.c +++ b/src/vconsole/vconsole-setup.c @@ -62,7 +62,7 @@ static int disable_utf8(int fd) { r = k; if (r < 0) - log_warning_errno(-r, "Failed to disable UTF-8: %m"); + log_warning_errno(r, "Failed to disable UTF-8: %m"); return r; } @@ -94,7 +94,7 @@ static int enable_utf8(int fd) { r = k; if (r < 0) - log_warning_errno(-r, "Failed to enable UTF-8: %m"); + log_warning_errno(r, "Failed to enable UTF-8: %m"); return r; } @@ -282,7 +282,7 @@ int main(int argc, char **argv) { NULL); if (r < 0 && r != -ENOENT) - log_warning_errno(-r, "Failed to read /etc/vconsole.conf: %m"); + log_warning_errno(r, "Failed to read /etc/vconsole.conf: %m"); /* Let the kernel command line override /etc/vconsole.conf */ if (detect_container(NULL) <= 0) { @@ -295,7 +295,7 @@ int main(int argc, char **argv) { NULL); if (r < 0 && r != -ENOENT) - log_warning_errno(-r, "Failed to read /proc/cmdline: %m"); + log_warning_errno(r, "Failed to read /proc/cmdline: %m"); } if (utf8) @@ -305,7 +305,7 @@ int main(int argc, char **argv) { r = font_load(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid); if (r < 0) { - log_error_errno(-r, "Failed to start " KBD_SETFONT ": %m"); + log_error_errno(r, "Failed to start " KBD_SETFONT ": %m"); return EXIT_FAILURE; } @@ -314,7 +314,7 @@ int main(int argc, char **argv) { r = keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid); if (r < 0) { - log_error_errno(-r, "Failed to start " KBD_LOADKEYS ": %m"); + log_error_errno(r, "Failed to start " KBD_LOADKEYS ": %m"); return EXIT_FAILURE; } |