diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 13:19:16 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 13:29:21 +0100 |
commit | da927ba997d68401563b927f92e6e40e021a8e5c (patch) | |
tree | 71764cd998aef07b8943c5206c9307a93ba9c528 /src/core | |
parent | 0a1beeb64207eaa88ab9236787b1cbc2f704ae14 (diff) |
treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/busname.c | 2 | ||||
-rw-r--r-- | src/core/cgroup.c | 16 | ||||
-rw-r--r-- | src/core/dbus-job.c | 4 | ||||
-rw-r--r-- | src/core/dbus-manager.c | 6 | ||||
-rw-r--r-- | src/core/dbus-unit.c | 4 | ||||
-rw-r--r-- | src/core/dbus.c | 70 | ||||
-rw-r--r-- | src/core/device.c | 10 | ||||
-rw-r--r-- | src/core/execute.c | 6 | ||||
-rw-r--r-- | src/core/hostname-setup.c | 2 | ||||
-rw-r--r-- | src/core/job.c | 2 | ||||
-rw-r--r-- | src/core/load-dropin.c | 4 | ||||
-rw-r--r-- | src/core/locale-setup.c | 4 | ||||
-rw-r--r-- | src/core/machine-id-setup.c | 4 | ||||
-rw-r--r-- | src/core/main.c | 52 | ||||
-rw-r--r-- | src/core/manager.c | 12 | ||||
-rw-r--r-- | src/core/mount.c | 2 | ||||
-rw-r--r-- | src/core/path.c | 2 | ||||
-rw-r--r-- | src/core/scope.c | 2 | ||||
-rw-r--r-- | src/core/shutdown.c | 12 | ||||
-rw-r--r-- | src/core/socket.c | 2 | ||||
-rw-r--r-- | src/core/swap.c | 2 | ||||
-rw-r--r-- | src/core/timer.c | 2 | ||||
-rw-r--r-- | src/core/transaction.c | 2 |
23 files changed, 112 insertions, 112 deletions
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; } |