diff --git a/src/boot/bless-boot.c b/src/boot/bless-boot.c index 8e6c146e69..f86d102f0b 100644 --- a/src/boot/bless-boot.c +++ b/src/boot/bless-boot.c @@ -469,7 +469,7 @@ static int verb_set(int argc, char *argv[], void *userdata) { /* First, fsync() the directory these files are located in */ r = fsync_parent_at(fd, skip_leading_slash(target)); if (r < 0) - log_debug_errno(errno, "Failed to synchronize image directory, ignoring: %m"); + log_debug_errno(r, "Failed to synchronize image directory, ignoring: %m"); /* Secondly, syncfs() the whole file system these files are located in */ if (syncfs(fd) < 0) diff --git a/src/core/exec-invoke.c b/src/core/exec-invoke.c index 2ecc9dd856..86bd797896 100644 --- a/src/core/exec-invoke.c +++ b/src/core/exec-invoke.c @@ -2896,7 +2896,7 @@ static int setup_ephemeral( */ r = chattr_fd(fd, FS_NOCOW_FL, FS_NOCOW_FL, NULL); if (r < 0) - log_debug_errno(fd, "Failed to disable copy-on-write for %s, ignoring: %m", new_root); + log_debug_errno(r, "Failed to disable copy-on-write for %s, ignoring: %m", new_root); } else { assert(*root_directory); diff --git a/src/core/main.c b/src/core/main.c index f3a40f65bb..db81b2f07e 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -2637,7 +2637,7 @@ static void setenv_manager_environment(void) { r = putenv_dup(*p, true); if (r < 0) - log_warning_errno(errno, "Failed to setenv \"%s\", ignoring: %m", *p); + log_warning_errno(r, "Failed to setenv \"%s\", ignoring: %m", *p); } } diff --git a/src/core/manager.c b/src/core/manager.c index 07d5d8cfaa..4c9ef44a4a 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -1242,13 +1242,13 @@ static int manager_setup_user_lookup_fd(Manager *m) { if (!m->user_lookup_event_source) { r = sd_event_add_io(m->event, &m->user_lookup_event_source, m->user_lookup_fds[0], EPOLLIN, manager_dispatch_user_lookup_fd, m); if (r < 0) - return log_error_errno(errno, "Failed to allocate user lookup event source: %m"); + return log_error_errno(r, "Failed to allocate user lookup event source: %m"); /* Process even earlier than the notify event source, so that we always know first about valid UID/GID * resolutions */ r = sd_event_source_set_priority(m->user_lookup_event_source, EVENT_PRIORITY_USER_LOOKUP); if (r < 0) - return log_error_errno(errno, "Failed to set priority of user lookup event source: %m"); + return log_error_errno(r, "Failed to set priority of user lookup event source: %m"); (void) sd_event_source_set_description(m->user_lookup_event_source, "user-lookup"); } @@ -1287,11 +1287,11 @@ static int manager_setup_handoff_timestamp_fd(Manager *m) { if (!m->handoff_timestamp_event_source) { r = sd_event_add_io(m->event, &m->handoff_timestamp_event_source, m->handoff_timestamp_fds[0], EPOLLIN, manager_dispatch_handoff_timestamp_fd, m); if (r < 0) - return log_error_errno(errno, "Failed to allocate handoff timestamp event source: %m"); + return log_error_errno(r, "Failed to allocate handoff timestamp event source: %m"); r = sd_event_source_set_priority(m->handoff_timestamp_event_source, EVENT_PRIORITY_HANDOFF_TIMESTAMP); if (r < 0) - return log_error_errno(errno, "Failed to set priority of handoff timestamp event source: %m"); + return log_error_errno(r, "Failed to set priority of handoff timestamp event source: %m"); (void) sd_event_source_set_description(m->handoff_timestamp_event_source, "handoff-timestamp"); } @@ -3069,7 +3069,7 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t r = manager_get_dump_string(m, /* patterns= */ NULL, &dump); if (r < 0) { - log_warning_errno(errno, "Failed to acquire manager dump: %m"); + log_warning_errno(r, "Failed to acquire manager dump: %m"); break; } @@ -3160,7 +3160,7 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t r = manager_get_dump_jobs_string(m, /* patterns= */ NULL, " ", &dump_jobs); if (r < 0) { - log_warning_errno(errno, "Failed to acquire manager jobs dump: %m"); + log_warning_errno(r, "Failed to acquire manager jobs dump: %m"); break; } diff --git a/src/home/homed-manager.c b/src/home/homed-manager.c index 8d67f425a5..7669cbb269 100644 --- a/src/home/homed-manager.c +++ b/src/home/homed-manager.c @@ -913,7 +913,7 @@ static int manager_assess_image( r = btrfs_is_subvol_fd(fd); if (r < 0) - return log_warning_errno(errno, "Failed to determine whether %s is a btrfs subvolume: %m", path); + return log_warning_errno(r, "Failed to determine whether %s is a btrfs subvolume: %m", path); if (r > 0) storage = USER_SUBVOLUME; else { @@ -1441,7 +1441,7 @@ static int manager_generate_key_pair(Manager *m) { /* Write out public key (note that we only do that as a help to the user, we don't make use of this ever */ r = fopen_temporary("/var/lib/systemd/home/local.public", &fpublic, &temp_public); if (r < 0) - return log_error_errno(errno, "Failed to open key file for writing: %m"); + return log_error_errno(r, "Failed to open key file for writing: %m"); if (PEM_write_PUBKEY(fpublic, m->private_key) <= 0) return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to write public key."); @@ -1455,7 +1455,7 @@ static int manager_generate_key_pair(Manager *m) { /* Write out the private key (this actually writes out both private and public, OpenSSL is confusing) */ r = fopen_temporary("/var/lib/systemd/home/local.private", &fprivate, &temp_private); if (r < 0) - return log_error_errno(errno, "Failed to open key file for writing: %m"); + return log_error_errno(r, "Failed to open key file for writing: %m"); if (PEM_write_PrivateKey(fprivate, m->private_key, NULL, NULL, 0, NULL, 0) <= 0) return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to write private key pair."); diff --git a/src/home/homework-blob.c b/src/home/homework-blob.c index 17cb7d6ce3..6b22ab6f24 100644 --- a/src/home/homework-blob.c +++ b/src/home/homework-blob.c @@ -264,7 +264,7 @@ int home_apply_new_blob_dir(UserRecord *h, Hashmap *blobs) { * of the directory. */ r = rm_rf_at(base_dfd, h->user_name, REMOVE_PHYSICAL|REMOVE_MISSING_OK); if (r < 0) - return log_error_errno(errno, "Failed to empty out system blob dir: %m"); + return log_error_errno(r, "Failed to empty out system blob dir: %m"); return 0; } diff --git a/src/home/homework-fscrypt.c b/src/home/homework-fscrypt.c index 781fe01f9c..46a7756873 100644 --- a/src/home/homework-fscrypt.c +++ b/src/home/homework-fscrypt.c @@ -212,7 +212,7 @@ static int fscrypt_setup( r = flistxattr_malloc(setup->root_fd, &xattr_buf); if (r < 0) - return log_error_errno(errno, "Failed to retrieve xattr list: %m"); + return log_error_errno(r, "Failed to retrieve xattr list: %m"); NULSTR_FOREACH(xa, xattr_buf) { _cleanup_free_ void *salt = NULL, *encrypted = NULL; @@ -635,7 +635,7 @@ int home_passwd_fscrypt( r = flistxattr_malloc(setup->root_fd, &xattr_buf); if (r < 0) - return log_error_errno(errno, "Failed to retrieve xattr list: %m"); + return log_error_errno(r, "Failed to retrieve xattr list: %m"); NULSTR_FOREACH(xa, xattr_buf) { const char *nr; diff --git a/src/home/homework-quota.c b/src/home/homework-quota.c index 7400937e95..c9516829d8 100644 --- a/src/home/homework-quota.c +++ b/src/home/homework-quota.c @@ -107,7 +107,7 @@ int home_update_quota_auto(UserRecord *h, const char *path) { r = btrfs_is_subvol(path); if (r < 0) - return log_error_errno(errno, "Failed to test if %s is a subvolume: %m", path); + return log_error_errno(r, "Failed to test if %s is a subvolume: %m", path); if (r == 0) return log_error_errno(SYNTHETIC_ERRNO(ENOTTY), "Directory %s is not a subvolume, cannot apply quota.", path); diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c index 64f8125df3..34d4062d4a 100644 --- a/src/journal-remote/journal-remote-main.c +++ b/src/journal-remote/journal-remote-main.c @@ -108,7 +108,7 @@ static int spawn_child(const char* child, char** argv) { r = fd_nonblock(fd[0], true); if (r < 0) - log_warning_errno(errno, "Failed to set child pipe to non-blocking: %m"); + log_warning_errno(r, "Failed to set child pipe to non-blocking: %m"); return fd[0]; } diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 029a7f9d88..5842d3ba8f 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -2668,7 +2668,7 @@ static int setup_journal(const char *directory) { r = mount_nofollow_verbose(LOG_DEBUG, p, q, NULL, MS_BIND, NULL); if (r < 0) - return log_error_errno(errno, "Failed to bind mount journal from host into guest: %m"); + return log_error_errno(r, "Failed to bind mount journal from host into guest: %m"); return 0; } diff --git a/src/nsresourced/userns-restrict.c b/src/nsresourced/userns-restrict.c index 4e917fd758..241a655e62 100644 --- a/src/nsresourced/userns-restrict.c +++ b/src/nsresourced/userns-restrict.c @@ -218,7 +218,7 @@ int userns_restrict_put_by_inode( r = sym_bpf_map_update_elem(outer_map_fd, &ino, &inner_map_fd, BPF_ANY); if (r < 0) - return log_debug_errno(errno, "Failed to replace map in inode hash: %m"); + return log_debug_errno(r, "Failed to replace map in inode hash: %m"); } else { /* Let's add an entry for this userns inode if missing. If it exists just extend the existing map. We * might race against each other, hence we try a couple of times */ @@ -258,7 +258,7 @@ int userns_restrict_put_by_inode( r = sym_bpf_map_update_elem(inner_map_fd, mntid, &dummy_value, BPF_ANY); if (r < 0) - return log_debug_errno(errno, "Failed to add mount ID to map: %m"); + return log_debug_errno(r, "Failed to add mount ID to map: %m"); log_debug("Allowing mount %i on userns inode %" PRIu64, *mntid, ino); } @@ -318,7 +318,7 @@ int userns_restrict_reset_by_inode( r = sym_bpf_map_delete_elem(outer_map_fd, &u); if (r < 0) - return log_debug_errno(outer_map_fd, "Failed to remove entry for inode %" PRIu64 " from outer map: %m", ino); + return log_debug_errno(r, "Failed to remove entry for inode %" PRIu64 " from outer map: %m", ino); return 0; } diff --git a/src/resolve/resolved-dns-stream.c b/src/resolve/resolved-dns-stream.c index 056ba7794f..1a43d0bd49 100644 --- a/src/resolve/resolved-dns-stream.c +++ b/src/resolve/resolved-dns-stream.c @@ -195,7 +195,7 @@ static int dns_stream_identify(DnsStream *s) { /* Make sure all packets for this connection are sent on the same interface */ r = socket_set_unicast_if(s->fd, s->local.sa.sa_family, s->ifindex); if (r < 0) - log_debug_errno(errno, "Failed to invoke IP_UNICAST_IF/IPV6_UNICAST_IF: %m"); + log_debug_errno(r, "Failed to invoke IP_UNICAST_IF/IPV6_UNICAST_IF: %m"); } s->identified = true; @@ -454,7 +454,7 @@ static int on_stream_io(sd_event_source *es, int fd, uint32_t revents, void *use if (progressed && s->timeout_event_source) { r = sd_event_source_set_time_relative(s->timeout_event_source, DNS_STREAM_ESTABLISHED_TIMEOUT_USEC); if (r < 0) - log_warning_errno(errno, "Couldn't restart TCP connection timeout, ignoring: %m"); + log_warning_errno(r, "Couldn't restart TCP connection timeout, ignoring: %m"); } return 0; diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c index c7af10687d..ef4f3b3b52 100644 --- a/src/shared/cgroup-show.c +++ b/src/shared/cgroup-show.c @@ -152,7 +152,7 @@ static int show_cgroup_name( if (FLAGS_SET(flags, OUTPUT_CGROUP_ID)) { r = cg_fd_get_cgroupid(fd, &cgroupid); if (r < 0) - log_debug_errno(errno, "Failed to determine cgroup ID of %s, ignoring: %m", path); + log_debug_errno(r, "Failed to determine cgroup ID of %s, ignoring: %m", path); } r = path_extract_filename(path, &b); diff --git a/src/shared/clean-ipc.c b/src/shared/clean-ipc.c index bbb343f3d3..1e90cc2a1c 100644 --- a/src/shared/clean-ipc.c +++ b/src/shared/clean-ipc.c @@ -58,7 +58,7 @@ static int clean_sysvipc_shm(uid_t delete_uid, gid_t delete_gid, bool rm) { r = read_line(f, LONG_LINE_MAX, &line); if (r < 0) - return log_warning_errno(errno, "Failed to read /proc/sysvipc/shm: %m"); + return log_warning_errno(r, "Failed to read /proc/sysvipc/shm: %m"); if (r == 0) break; diff --git a/src/test/test-bpf-foreign-programs.c b/src/test/test-bpf-foreign-programs.c index cb6073d2a7..34ccb74ccb 100644 --- a/src/test/test-bpf-foreign-programs.c +++ b/src/test/test-bpf-foreign-programs.c @@ -253,7 +253,7 @@ static int test_bpf_cgroup_programs(Manager *m, const char *unit_name, const Tes while (!IN_SET(SERVICE(u)->state, SERVICE_DEAD, SERVICE_FAILED)) { r = sd_event_run(m->event, UINT64_MAX); if (r < 0) - return log_error_errno(errno, "Event run failed %m"); + return log_error_errno(r, "Event run failed %m"); } cld_code = SERVICE(u)->exec_command[SERVICE_EXEC_START]->exec_status.code; diff --git a/src/test/test-bpf-restrict-fs.c b/src/test/test-bpf-restrict-fs.c index f42ca4edb9..7ece33750b 100644 --- a/src/test/test-bpf-restrict-fs.c +++ b/src/test/test-bpf-restrict-fs.c @@ -46,7 +46,7 @@ static int test_restrict_filesystems(Manager *m, const char *unit_name, const ch while (!IN_SET(SERVICE(u)->state, SERVICE_DEAD, SERVICE_FAILED)) { r = sd_event_run(m->event, UINT64_MAX); if (r < 0) - return log_error_errno(errno, "Event run failed %m"); + return log_error_errno(r, "Event run failed %m"); } cld_code = SERVICE(u)->exec_command[SERVICE_EXEC_START]->exec_status.code; diff --git a/src/test/test-socket-bind.c b/src/test/test-socket-bind.c index fb65573e7a..13ffa92cf1 100644 --- a/src/test/test-socket-bind.c +++ b/src/test/test-socket-bind.c @@ -83,7 +83,7 @@ static int test_socket_bind( while (!IN_SET(SERVICE(u)->state, SERVICE_DEAD, SERVICE_FAILED)) { r = sd_event_run(m->event, UINT64_MAX); if (r < 0) - return log_error_errno(errno, "Event run failed %m"); + return log_error_errno(r, "Event run failed %m"); } cld_code = SERVICE(u)->exec_command[SERVICE_EXEC_START]->exec_status.code; diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index 51732080e8..581bbaf345 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -1536,7 +1536,7 @@ int udev_rules_parse_file(UdevRules *rules, const char *filename, bool extra_che r = hashmap_put_stats_by_path(&rules->stats_by_path, filename, &st); if (r < 0) - return log_warning_errno(errno, "Failed to save stat for %s, ignoring: %m", filename); + return log_warning_errno(r, "Failed to save stat for %s, ignoring: %m", filename); (void) fd_warn_permissions(filename, fileno(f));