mirror of
https://github.com/systemd/systemd
synced 2024-07-21 18:24:38 +00:00
Merge pull request #32683 from dtardon/fix-error-vars
More mismatched error variables
This commit is contained in:
commit
1213fc94b4
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.");
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
Loading…
Reference in a new issue