1
0
mirror of https://github.com/systemd/systemd synced 2024-07-01 07:34:28 +00:00

tree-wise: several cleanups for logging

- drop unnecessary SYNTHETIC_ERRNO() when the logger does not propagate
  error code,
- drop unnecessary '%m' in error message when the error code is
  specified with SYNTHETIC_ERRNO(),
- add missing full stop at the end of log message,
- use RET_GATHER(),
- add missing ", ignoring.",
- upeercase the first letter, etc., etc...
This commit is contained in:
Yu Watanabe 2024-04-30 22:54:12 +09:00
parent ba2caa8a38
commit 4e494e6aac
43 changed files with 167 additions and 185 deletions

View File

@ -38,7 +38,7 @@ int verb_srk(int argc, char *argv[], void *userdata) {
"Refusing to write binary data to TTY, please redirect output to file.");
if (fwrite(marshalled, 1, marshalled_size, stdout) != marshalled_size)
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to write SRK to stdout: %m");
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to write SRK to stdout.");
r = fflush_and_check(stdout);
if (r < 0)

View File

@ -388,7 +388,7 @@ static int verb_status(int argc, char *argv[], void *userdata) {
/* We didn't find any of the three? If so, let's try the next directory, before we give up. */
}
return log_error_errno(SYNTHETIC_ERRNO(EBUSY), "Couldn't determine boot state: %m");
return log_error_errno(SYNTHETIC_ERRNO(EBUSY), "Couldn't determine boot state.");
}
static int verb_set(int argc, char *argv[], void *userdata) {
@ -479,8 +479,7 @@ static int verb_set(int argc, char *argv[], void *userdata) {
return 0;
}
log_error_errno(SYNTHETIC_ERRNO(EBUSY), "Can't find boot counter source file for '%s': %m", target);
return 1;
return log_error_errno(SYNTHETIC_ERRNO(EBUSY), "Can't find boot counter source file for '%s'.", target);
exists:
log_debug("Operation already executed before, not doing anything.");

View File

@ -38,7 +38,7 @@ static int parse_timeout(const char *arg1, char16_t **ret_timeout, size_t *ret_t
(void) efi_loader_get_features(&loader_features);
if (!(loader_features & EFI_LOADER_FEATURE_MENU_DISABLE)) {
if (!arg_graceful)
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "Loader does not support 'menu-disabled': %m");
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "Loader does not support 'menu-disabled'.");
log_warning("Loader does not support 'menu-disabled', setting anyway.");
}

View File

@ -348,7 +348,7 @@ int verb_status(int argc, char *argv[], void *userdata) {
const char *path = arg_dollar_boot_path();
if (!path)
return log_error_errno(SYNTHETIC_ERRNO(EACCES), "Failed to determine XBOOTLDR location: %m");
return log_error_errno(SYNTHETIC_ERRNO(EACCES), "Failed to determine XBOOTLDR location.");
puts(path);
return 0;

View File

@ -111,8 +111,7 @@ bool bpf_restrict_fs_supported(bool initialize) {
return (supported = false);
}
if (r == 0) {
log_info_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
"bpf-restrict-fs: BPF LSM hook not enabled in the kernel, BPF LSM not supported");
log_info("bpf-restrict-fs: BPF LSM hook not enabled in the kernel, BPF LSM not supported.");
return (supported = false);
}
@ -121,8 +120,7 @@ bool bpf_restrict_fs_supported(bool initialize) {
return (supported = false);
if (!bpf_can_link_lsm_program(obj->progs.restrict_filesystems)) {
log_warning_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
"bpf-restrict-fs: Failed to link program; assuming BPF LSM is not available");
log_warning("bpf-restrict-fs: Failed to link program; assuming BPF LSM is not available.");
return (supported = false);
}
@ -258,11 +256,11 @@ bool bpf_restrict_fs_supported(bool initialize) {
}
int bpf_restrict_fs_setup(Manager *m) {
return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "bpf-restrict-fs: Failed to set up LSM BPF: %m");
return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "bpf-restrict-fs: BPF framework is not supported.");
}
int bpf_restrict_fs_update(const Set *filesystems, uint64_t cgroup_id, int outer_map_fd, const bool allow_list) {
return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "bpf-restrict-fs: Failed to restrict filesystems using LSM BPF: %m");
return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "bpf-restrict-fs: BPF framework is not supported.");
}
int bpf_restrict_fs_cleanup(Unit *u) {

View File

@ -20,8 +20,7 @@ bool cgroup_bpf_supported(void) {
}
if (r == 0) {
log_info_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
"Not running with unified cgroup hierarchy, disabling cgroup BPF features.");
log_info("Not running with unified cgroup hierarchy, disabling cgroup BPF features.");
return (supported = false);
}

View File

@ -1129,7 +1129,7 @@ int cgroup_context_add_bpf_foreign_program(CGroupContext *c, uint32_t attach_typ
assert(bpffs_path);
if (!path_is_normalized(bpffs_path) || !path_is_absolute(bpffs_path))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Path is not normalized: %m");
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Path is not normalized.");
d = strdup(bpffs_path);
if (!d)
@ -1954,7 +1954,7 @@ static int cgroup_apply_devices(Unit *u) {
}
if (prog && !any) {
log_unit_warning_errno(u, SYNTHETIC_ERRNO(ENODEV), "No devices matched by device filter.");
log_unit_warning(u, "No devices matched by device filter.");
/* The kernel verifier would reject a program we would build with the normal intro and outro
but no allow-listing rules (outro would contain an unreachable instruction for successful
@ -5109,7 +5109,7 @@ static int unit_cgroup_freezer_kernel_state(Unit *u, FreezerState *ret) {
else if (streq(val, "1"))
s = FREEZER_FROZEN;
else {
log_unit_debug_errno(u, SYNTHETIC_ERRNO(EINVAL), "Unexpected cgroup frozen state: %s", val);
log_unit_debug(u, "Unexpected cgroup frozen state: %s", val);
s = _FREEZER_STATE_INVALID;
}

View File

@ -2932,7 +2932,7 @@ static int aux_scope_from_message(Manager *m, sd_bus_message *message, Unit **re
unit = manager_get_unit_by_pidref(m, &p);
if (!unit) {
log_unit_warning_errno(from, SYNTHETIC_ERRNO(ENOENT), "Failed to get unit from PIDFD, ignoring: %m");
log_unit_warning(from, "Failed to get unit from PIDFD, ignoring.");
continue;
}

View File

@ -4204,7 +4204,7 @@ int exec_invoke(
*exit_status = EXIT_CONFIRM;
return log_exec_error_errno(context, params, SYNTHETIC_ERRNO(ECANCELED),
"Execution cancelled by the user");
"Execution cancelled by the user.");
}
}
@ -4246,12 +4246,12 @@ int exec_invoke(
if (!uid_is_valid(uid)) {
*exit_status = EXIT_USER;
return log_exec_error_errno(context, params, SYNTHETIC_ERRNO(ESRCH), "UID validation failed for \""UID_FMT"\"", uid);
return log_exec_error_errno(context, params, SYNTHETIC_ERRNO(ESRCH), "UID validation failed for \""UID_FMT"\".", uid);
}
if (!gid_is_valid(gid)) {
*exit_status = EXIT_USER;
return log_exec_error_errno(context, params, SYNTHETIC_ERRNO(ESRCH), "GID validation failed for \""GID_FMT"\"", gid);
return log_exec_error_errno(context, params, SYNTHETIC_ERRNO(ESRCH), "GID validation failed for \""GID_FMT"\".", gid);
}
if (runtime->dynamic_creds->user)

View File

@ -1360,7 +1360,7 @@ static int mount_image(
if (r < 0)
return log_debug_errno(r, "Failed to acquire 'os-release' data of OS tree '%s': %m", empty_to_root(root_directory));
if (isempty(host_os_release_id))
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "'ID' field not found or empty in 'os-release' data of OS tree '%s': %m", empty_to_root(root_directory));
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "'ID' field not found or empty in 'os-release' data of OS tree '%s'.", empty_to_root(root_directory));
}
r = verity_dissect_and_mount(
@ -1532,7 +1532,7 @@ static int apply_one_mount(
r = mode_to_inaccessible_node(runtime_dir, target.st_mode, &inaccessible);
if (r < 0)
return log_debug_errno(SYNTHETIC_ERRNO(ELOOP),
"File type not supported for inaccessible mounts. Note that symlinks are not allowed");
"File type not supported for inaccessible mounts. Note that symlinks are not allowed.");
what = inaccessible;
break;
}
@ -1583,7 +1583,7 @@ static int apply_one_mount(
if (r < 0)
return log_debug_errno(r, "Failed to acquire 'os-release' data of OS tree '%s': %m", empty_to_root(root_directory));
if (isempty(host_os_release_id))
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "'ID' field not found or empty in 'os-release' data of OS tree '%s': %m", empty_to_root(root_directory));
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "'ID' field not found or empty in 'os-release' data of OS tree '%s'.", empty_to_root(root_directory));
r = load_extension_release_pairs(mount_entry_source(m), class, extension_name, /* relax_extension_release_check= */ false, &extension_release);
if (r == -ENOENT && m->ignore)
@ -1602,7 +1602,7 @@ static int apply_one_mount(
if (r < 0)
return log_debug_errno(r, "Failed to compare directory %s extension-release metadata with the root's os-release: %m", extension_name);
if (r == 0)
return log_debug_errno(SYNTHETIC_ERRNO(ESTALE), "Directory %s extension-release metadata does not match the root's", extension_name);
return log_debug_errno(SYNTHETIC_ERRNO(ESTALE), "Directory %s extension-release metadata does not match the root's.", extension_name);
_fallthrough_;
}

View File

@ -243,12 +243,12 @@ int unit_add_name(Unit *u, const char *text) {
if (unit_name_is_valid(text, UNIT_NAME_TEMPLATE)) {
if (!u->instance)
return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EINVAL),
"instance is not set when adding name '%s': %m", text);
"Instance is not set when adding name '%s'.", text);
r = unit_name_replace_instance(text, u->instance, &name);
if (r < 0)
return log_unit_debug_errno(u, r,
"failed to build instance name from '%s': %m", text);
"Failed to build instance name from '%s': %m", text);
} else {
name = strdup(text);
if (!name)
@ -260,47 +260,47 @@ int unit_add_name(Unit *u, const char *text) {
if (hashmap_contains(u->manager->units, name))
return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EEXIST),
"unit already exist when adding name '%s': %m", name);
"Unit already exist when adding name '%s'.", name);
if (!unit_name_is_valid(name, UNIT_NAME_PLAIN|UNIT_NAME_INSTANCE))
return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EINVAL),
"name '%s' is invalid: %m", name);
"Name '%s' is invalid.", name);
t = unit_name_to_type(name);
if (t < 0)
return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EINVAL),
"failed to derive unit type from name '%s': %m", name);
"failed to derive unit type from name '%s'.", name);
if (u->type != _UNIT_TYPE_INVALID && t != u->type)
return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EINVAL),
"unit type is illegal: u->type(%d) and t(%d) for name '%s': %m",
"Unit type is illegal: u->type(%d) and t(%d) for name '%s'.",
u->type, t, name);
r = unit_name_to_instance(name, &instance);
if (r < 0)
return log_unit_debug_errno(u, r, "failed to extract instance from name '%s': %m", name);
return log_unit_debug_errno(u, r, "Failed to extract instance from name '%s': %m", name);
if (instance && !unit_type_may_template(t))
return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EINVAL), "templates are not allowed for name '%s': %m", name);
return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EINVAL), "Templates are not allowed for name '%s'.", name);
/* Ensure that this unit either has no instance, or that the instance matches. */
if (u->type != _UNIT_TYPE_INVALID && !streq_ptr(u->instance, instance))
return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EINVAL),
"cannot add name %s, the instances don't match (\"%s\" != \"%s\").",
"Cannot add name %s, the instances don't match (\"%s\" != \"%s\").",
name, instance, u->instance);
if (u->id && !unit_type_may_alias(t))
return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EEXIST),
"cannot add name %s, aliases are not allowed for %s units.",
"Cannot add name %s, aliases are not allowed for %s units.",
name, unit_type_to_string(t));
if (hashmap_size(u->manager->units) >= MANAGER_MAX_NAMES)
return log_unit_warning_errno(u, SYNTHETIC_ERRNO(E2BIG), "cannot add name, manager has too many units: %m");
return log_unit_warning_errno(u, SYNTHETIC_ERRNO(E2BIG), "Cannot add name, manager has too many units.");
/* Add name to the global hashmap first, because that's easier to undo */
r = hashmap_put(u->manager->units, name, u);
if (r < 0)
return log_unit_debug_errno(u, r, "add unit to hashmap failed for name '%s': %m", text);
return log_unit_debug_errno(u, r, "Add unit to hashmap failed for name '%s': %m", text);
if (u->id) {
r = unit_add_alias(u, name); /* unit_add_alias() takes ownership of the name on success */

View File

@ -630,8 +630,7 @@ static int allocate_journal_field(int fd, size_t size, char **ret, size_t *ret_s
if (n < 0)
return log_error_errno((int) n, "Failed to read core data: %m");
if ((size_t) n < size)
return log_error_errno(SYNTHETIC_ERRNO(EIO),
"Core data too short.");
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Core data too short.");
*ret = TAKE_PTR(field);
*ret_size = size + 9;
@ -1550,7 +1549,7 @@ static int forward_coredump_to_container(Context *context) {
if (r < 0)
return log_debug_errno(r, "Failed to wait for child to terminate: %m");
if (r != EXIT_SUCCESS)
return log_debug_errno(SYNTHETIC_ERRNO(EPROTO), "Failed to process coredump in container: %m");
return log_debug_errno(SYNTHETIC_ERRNO(EPROTO), "Failed to process coredump in container.");
return 0;
}

View File

@ -382,9 +382,7 @@ static int verb_cat(int argc, char **argv, void *userdata) {
int encrypted;
if (!credential_name_valid(*cn)) {
log_error("Credential name '%s' is not valid.", *cn);
if (ret >= 0)
ret = -EINVAL;
RET_GATHER(ret, log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Credential name '%s' is not valid.", *cn));
continue;
}
@ -409,16 +407,11 @@ static int verb_cat(int argc, char **argv, void *userdata) {
if (r >= 0) /* Found */
break;
log_error_errno(r, "Failed to read credential '%s': %m", *cn);
if (ret >= 0)
ret = r;
RET_GATHER(ret, log_error_errno(r, "Failed to read credential '%s': %m", *cn));
}
if (encrypted >= 2) { /* Found nowhere */
log_error_errno(SYNTHETIC_ERRNO(ENOENT), "Credential '%s' not set.", *cn);
if (ret >= 0)
ret = -ENOENT;
RET_GATHER(ret, log_error_errno(SYNTHETIC_ERRNO(ENOENT), "Credential '%s' not set.", *cn));
continue;
}

View File

@ -21,10 +21,10 @@ static int uri_set_private_class(const char *uri, char **ret_uri) {
CK_ATTRIBUTE attribute = { CKA_CLASS, &class, sizeof(class) };
if (sym_p11_kit_uri_set_attribute(p11kit_uri, &attribute) != P11_KIT_URI_OK)
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to set class for URI '%s': %m", uri);
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to set class for URI '%s'.", uri);
if (sym_p11_kit_uri_format(p11kit_uri, P11_KIT_URI_FOR_ANY, &private_uri) != P11_KIT_URI_OK)
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to format PKCS#11 URI: %m");
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to format PKCS#11 URI.");
}
*ret_uri = TAKE_PTR(private_uri);

View File

@ -143,7 +143,7 @@ static int determine_default_node(void) {
return log_error_errno(r, "Unable to query DM_UUID udev property of backing block device for /var/: %m");
if (!startswith(dm_uuid, "CRYPT-LUKS2-"))
return log_error_errno(SYNTHETIC_ERRNO(ENXIO), "Block device backing /var/ is not a LUKS2 device: %m");
return log_error_errno(SYNTHETIC_ERRNO(ENXIO), "Block device backing /var/ is not a LUKS2 device.");
_cleanup_(sd_device_unrefp) sd_device *origin = NULL;
r = block_device_get_originating(dev, &origin);

View File

@ -343,7 +343,7 @@ static int parse_one_option(const char *option) {
arg_pkcs11_uri_auto = true;
} else {
if (!pkcs11_uri_valid(val))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "pkcs11-uri= parameter expects a PKCS#11 URI, refusing");
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "pkcs11-uri= parameter expects a PKCS#11 URI, refusing.");
r = free_and_strdup(&arg_pkcs11_uri, val);
if (r < 0)
@ -523,7 +523,7 @@ static int parse_one_option(const char *option) {
* where %<key_type> is optional and defaults to 'user'.
*/
if (!(sep = strstr(val, "::")))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse link-volume-key= option value: %m");
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse link-volume-key= option value: %s", val);
/* cryptsetup (cli) supports <keyring_description> passed in various formats:
* - well-known keyrings prefixed with '@' (@u user, @s session, etc)
@ -544,7 +544,7 @@ static int parse_one_option(const char *option) {
if (*sep == '%') {
/* must be separated by colon */
if (!(c = strchr(sep, ':')))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse link-volume-key= option value: %m");
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse link-volume-key= option value: %s", val);
key_type = strndup(sep + 1, c - sep - 1);
if (!key_type)

View File

@ -162,7 +162,7 @@ static int add_cryptsetup(
return 0;
#else
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
"Partition is encrypted, but systemd-gpt-auto-generator was compiled without libcryptsetup support");
"Partition is encrypted, but systemd-gpt-auto-generator was compiled without libcryptsetup support.");
#endif
}

View File

@ -1223,7 +1223,7 @@ static int acquire_new_password(
_cleanup_free_ char *question = NULL;
if (--i == 0)
return log_error_errno(SYNTHETIC_ERRNO(ENOKEY), "Too many attempts, giving up:");
return log_error_errno(SYNTHETIC_ERRNO(ENOKEY), "Too many attempts, giving up.");
if (asprintf(&question, "Please enter new password for user %s:", user_name) < 0)
return log_oom();
@ -1527,7 +1527,7 @@ static int create_home(int argc, char *argv[], void *userdata) {
/* Before we consider the user name invalid, let's check if we can split it? */
r = split_user_name_realm(argv[1], &un, &rr);
if (r < 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "User name '%s' is not valid: %m", argv[1]);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "User name '%s' is not valid.", argv[1]);
if (rr) {
r = json_variant_set_field_string(&arg_identity_extra, "realm", rr);
@ -3015,7 +3015,7 @@ static int parse_argv(int argc, char *argv[]) {
if (r < 0)
return log_error_errno(r, "Failed to determine whether realm '%s' is a valid DNS domain: %m", optarg);
if (r == 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Realm '%s' is not a valid DNS domain: %m", optarg);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Realm '%s' is not a valid DNS domain.", optarg);
r = json_variant_set_field_string(&arg_identity_extra, "realm", optarg);
if (r < 0)
@ -3164,15 +3164,15 @@ static int parse_argv(int argc, char *argv[]) {
r = rlimit_parse(l, eq + 1, &rl);
if (r < 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse resource limit value: %s", eq + 1);
return log_error_errno(r, "Failed to parse resource limit value: %s", eq + 1);
r = rl.rlim_cur == RLIM_INFINITY ? json_variant_new_null(&jcur) : json_variant_new_unsigned(&jcur, rl.rlim_cur);
if (r < 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to allocate current integer: %m");
return log_error_errno(r, "Failed to allocate current integer: %m");
r = rl.rlim_max == RLIM_INFINITY ? json_variant_new_null(&jmax) : json_variant_new_unsigned(&jmax, rl.rlim_max);
if (r < 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to allocate maximum integer: %m");
return log_error_errno(r, "Failed to allocate maximum integer: %m");
t = strjoin("RLIMIT_", rlimit_to_string(l));
if (!t)

View File

@ -1054,7 +1054,7 @@ static int manager_bind_varlink(Manager *m) {
/* Avoid recursion */
if (setenv("SYSTEMD_BYPASS_USERDB", m->userdb_service, 1) < 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to set $SYSTEMD_BYPASS_USERDB: %m");
return log_error_errno(errno, "Failed to set $SYSTEMD_BYPASS_USERDB: %m");
return 0;
}

View File

@ -131,7 +131,7 @@ static int fscrypt_slot_try_one(
salt, salt_size,
0xFFFF, EVP_sha512(),
sizeof(derived), derived) != 1)
return log_error_errno(SYNTHETIC_ERRNO(ENOTRECOVERABLE), "PBKDF2 failed");
return log_error_errno(SYNTHETIC_ERRNO(ENOTRECOVERABLE), "PBKDF2 failed.");
context = EVP_CIPHER_CTX_new();
if (!context)
@ -236,7 +236,7 @@ static int fscrypt_setup(
e = memchr(value, ':', n);
if (!e)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "xattr %s lacks ':' separator: %m", xa);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "xattr %s lacks ':' separator.", xa);
r = unbase64mem_full(value, e - value, /* secure = */ false, &salt, &salt_size);
if (r < 0)

View File

@ -339,7 +339,7 @@ static int luks_get_volume_key(
/* Shortcut: If volume key was loaded from the keyring then just use it */
if (cache->volume_key_size > *volume_key_size)
return log_error_errno(SYNTHETIC_ERRNO(ENOBUFS),
"LUKS volume key from kernel keyring too big for buffer (need %zu bytes, have %zu)",
"LUKS volume key from kernel keyring too big for buffer (need %zu bytes, have %zu).",
cache->volume_key_size, *volume_key_size);
memcpy(volume_key, cache->volume_key, cache->volume_key_size);
*volume_key_size = cache->volume_key_size;
@ -418,7 +418,7 @@ static int luks_setup(
r = sym_crypt_get_volume_key_size(cd);
if (r <= 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to determine LUKS volume key size");
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to determine LUKS volume key size.");
vks = (size_t) r;
if (!sd_id128_is_null(uuid) || ret_found_uuid) {
@ -563,7 +563,7 @@ static int luks_open(
r = sym_crypt_get_volume_key_size(setup->crypt_device);
if (r <= 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to determine LUKS volume key size");
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to determine LUKS volume key size.");
vks = (size_t) r;
if (ret_found_uuid) {
@ -993,7 +993,7 @@ static int format_luks_token_text(
assert((size_t) encrypted_size_out1 <= encrypted_size);
if (EVP_EncryptFinal_ex(context, (uint8_t*) encrypted + encrypted_size_out1, &encrypted_size_out2) != 1)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to finish encryption of JSON record. ");
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to finish encryption of JSON record.");
assert((size_t) encrypted_size_out1 + (size_t) encrypted_size_out2 <= encrypted_size);
@ -2734,7 +2734,7 @@ static int prepare_resize_partition(
p = fdisk_table_get_partition(t, i);
if (!p)
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to read partition metadata: %m");
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to read partition metadata.");
if (fdisk_partition_is_used(p) <= 0)
continue;
@ -3731,7 +3731,7 @@ int home_unlock_luks(UserRecord *h, HomeSetup *setup, const PasswordCache *cache
r = sym_crypt_get_volume_key_size(setup->crypt_device);
if (r <= 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to determine LUKS volume key size");
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to determine LUKS volume key size.");
vks = (size_t) r;
vk = malloc(vks);

View File

@ -19,7 +19,7 @@ TEST(log_device_full) {
r = log_device_full_errno(dev, level, 0, "test level=%d errno=0: %m", level);
assert_se(r == 0);
r = log_device_full_errno(dev, level, SYNTHETIC_ERRNO(ENODATA), "test level=%d errno=S(ENODATA): %m", level);
r = log_device_full_errno(dev, level, SYNTHETIC_ERRNO(ENODATA), "test level=%d errno=S(ENODATA).", level);
assert_se(r == -ENODATA);
}
}

View File

@ -313,15 +313,15 @@ static int hwdb_new(const char *path, sd_hwdb **ret) {
if (!hwdb->f)
return log_debug_errno(SYNTHETIC_ERRNO(ENOENT),
"hwdb.bin does not exist, please run 'systemd-hwdb update'");
"hwdb.bin does not exist, please run 'systemd-hwdb update'.");
}
if (fstat(fileno(hwdb->f), &hwdb->st) < 0)
return log_debug_errno(errno, "Failed to stat %s: %m", path);
if (hwdb->st.st_size < (off_t) offsetof(struct trie_header_f, strings_len) + 8)
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "File %s is too short: %m", path);
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "File %s is too short.", path);
if (file_offset_beyond_memory_size(hwdb->st.st_size))
return log_debug_errno(SYNTHETIC_ERRNO(EFBIG), "File %s is too long: %m", path);
return log_debug_errno(SYNTHETIC_ERRNO(EFBIG), "File %s is too long.", path);
hwdb->map = mmap(0, hwdb->st.st_size, PROT_READ, MAP_SHARED, fileno(hwdb->f), 0);
if (hwdb->map == MAP_FAILED)
@ -330,7 +330,7 @@ static int hwdb_new(const char *path, sd_hwdb **ret) {
if (memcmp(hwdb->map, sig, sizeof(hwdb->head->signature)) != 0 ||
(size_t) hwdb->st.st_size != le64toh(hwdb->head->file_size))
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL),
"Failed to recognize the format of %s", path);
"Failed to recognize the format of %s.", path);
log_debug("=== trie on-disk ===");
log_debug("tool version: %"PRIu64, le64toh(hwdb->head->tool_version));

View File

@ -449,8 +449,7 @@ int netdev_generate_hw_addr(
memcpy(a.bytes, &result, a.length);
if (ether_addr_is_null(&a.ether) || ether_addr_is_broadcast(&a.ether)) {
log_netdev_warning_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
"Failed to generate persistent MAC address, ignoring: %m");
log_netdev_warning(netdev, "Failed to generate persistent MAC address, ignoring.");
a = HW_ADDR_NULL;
goto finalize;
}
@ -458,8 +457,7 @@ int netdev_generate_hw_addr(
break;
case ARPHRD_INFINIBAND:
if (result == 0) {
log_netdev_warning_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
"Failed to generate persistent MAC address: %m");
log_netdev_warning(netdev, "Failed to generate persistent MAC address.");
goto finalize;
}

View File

@ -1073,9 +1073,7 @@ static int get_gateway_description(
}
if (type != RTM_NEWNEIGH) {
log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Got unexpected netlink message type %u, ignoring",
type);
log_error("Got unexpected netlink message type %u, ignoring.", type);
continue;
}
@ -1086,7 +1084,7 @@ static int get_gateway_description(
}
if (fam != family) {
log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Got invalid rtnl family %d, ignoring", fam);
log_error("Got invalid rtnl family %d, ignoring.", fam);
continue;
}

View File

@ -863,7 +863,7 @@ static int oci_devices(const char *name, JsonVariant *v, JsonDispatchFlags flags
if (node->major == UINT_MAX || node->minor == UINT_MAX) {
r = json_log(e, flags, SYNTHETIC_ERRNO(EINVAL),
"Major/minor required when device node is device node");
"Major/minor required when device node is device node.");
goto fail_element;
}
@ -1148,7 +1148,7 @@ static int oci_cgroup_memory_limit(const char *name, JsonVariant *v, JsonDispatc
if (!json_variant_is_unsigned(v))
return json_log(v, flags, SYNTHETIC_ERRNO(EINVAL),
"Memory limit is not an unsigned integer");
"Memory limit is not an unsigned integer.");
k = json_variant_unsigned(v);
if (k >= UINT64_MAX)
@ -1716,7 +1716,7 @@ static int oci_seccomp_archs(const char *name, JsonVariant *v, JsonDispatchFlags
if (!json_variant_is_string(e))
return json_log(e, flags, SYNTHETIC_ERRNO(EINVAL),
"Architecture entry is not a string");
"Architecture entry is not a string.");
r = oci_seccomp_arch_from_string(json_variant_string(e), &a);
if (r < 0)

View File

@ -228,7 +228,7 @@ static int run(int argc, char *argv[]) {
if (r < 0)
return log_error_errno(r, "Failed to check if \"%s\" is a mount point: %m", arg_target);
if (r == 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "\"%s\" is not a mount point: %m", arg_target);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "\"%s\" is not a mount point.", arg_target);
mountfd = open(arg_target, O_RDONLY|O_CLOEXEC|O_DIRECTORY);
if (mountfd < 0)

View File

@ -1803,12 +1803,12 @@ static int config_parse_mountpoint(
return 0;
}
if (r < 1) {
log_syntax(unit, LOG_WARNING, filename, line, SYNTHETIC_ERRNO(EINVAL),
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Too few arguments in %s=, ignoring: %s", lvalue, rvalue);
return 0;
}
if (!isempty(q)) {
log_syntax(unit, LOG_WARNING, filename, line, SYNTHETIC_ERRNO(EINVAL),
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Too many arguments in %s=, ignoring: %s", lvalue, rvalue);
return 0;
}
@ -1860,18 +1860,18 @@ static int config_parse_encrypted_volume(
return 0;
}
if (r < 1) {
log_syntax(unit, LOG_WARNING, filename, line, SYNTHETIC_ERRNO(EINVAL),
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Too few arguments in %s=, ignoring: %s", lvalue, rvalue);
return 0;
}
if (!isempty(q)) {
log_syntax(unit, LOG_WARNING, filename, line, SYNTHETIC_ERRNO(EINVAL),
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Too many arguments in %s=, ignoring: %s", lvalue, rvalue);
return 0;
}
if (!filename_is_valid(volume)) {
log_syntax(unit, LOG_WARNING, filename, line, SYNTHETIC_ERRNO(EINVAL),
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Volume name %s is not valid, ignoring", volume);
return 0;
}
@ -1997,20 +1997,20 @@ static int partition_read_definition(Partition *p, const char *path, const char
if (p->minimize != MINIMIZE_OFF && !p->format && p->verity != VERITY_HASH)
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL),
"Minimize= can only be enabled if Format= or Verity=hash are set");
"Minimize= can only be enabled if Format= or Verity=hash are set.");
if (p->minimize == MINIMIZE_BEST && (p->format && !fstype_is_ro(p->format)) && p->verity != VERITY_HASH)
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL),
"Minimize=best can only be used with read-only filesystems or Verity=hash");
"Minimize=best can only be used with read-only filesystems or Verity=hash.");
if ((!strv_isempty(p->copy_files) || !strv_isempty(p->make_directories)) && !mkfs_supports_root_option(p->format) && geteuid() != 0)
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EPERM),
"Need to be root to populate %s filesystems with CopyFiles=/MakeDirectories=",
"Need to be root to populate %s filesystems with CopyFiles=/MakeDirectories=.",
p->format);
if (p->format && fstype_is_ro(p->format) && strv_isempty(p->copy_files) && strv_isempty(p->make_directories))
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL),
"Cannot format %s filesystem without source files, refusing", p->format);
"Cannot format %s filesystem without source files, refusing.", p->format);
if (p->verity != VERITY_OFF || p->encrypt != ENCRYPT_OFF) {
r = dlopen_cryptsetup();
@ -2021,47 +2021,47 @@ static int partition_read_definition(Partition *p, const char *path, const char
if (p->verity != VERITY_OFF && !p->verity_match_key)
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL),
"VerityMatchKey= must be set if Verity=%s", verity_mode_to_string(p->verity));
"VerityMatchKey= must be set if Verity=%s.", verity_mode_to_string(p->verity));
if (p->verity == VERITY_OFF && p->verity_match_key)
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL),
"VerityMatchKey= can only be set if Verity= is not \"%s\"",
"VerityMatchKey= can only be set if Verity= is not \"%s\".",
verity_mode_to_string(p->verity));
if (IN_SET(p->verity, VERITY_HASH, VERITY_SIG) &&
(p->copy_files || p->copy_blocks_path || p->copy_blocks_auto || p->format || p->make_directories))
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL),
"CopyBlocks=/CopyFiles=/Format=/MakeDirectories= cannot be used with Verity=%s",
"CopyBlocks=/CopyFiles=/Format=/MakeDirectories= cannot be used with Verity=%s.",
verity_mode_to_string(p->verity));
if (p->verity != VERITY_OFF && p->encrypt != ENCRYPT_OFF)
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL),
"Encrypting verity hash/data partitions is not supported");
"Encrypting verity hash/data partitions is not supported.");
if (p->verity == VERITY_SIG && !arg_private_key)
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL),
"Verity signature partition requested but no private key provided (--private-key=)");
"Verity signature partition requested but no private key provided (--private-key=).");
if (p->verity == VERITY_SIG && !arg_certificate)
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL),
"Verity signature partition requested but no PEM certificate provided (--certificate=)");
"Verity signature partition requested but no PEM certificate provided (--certificate=).");
if (p->verity == VERITY_SIG && (p->size_min != UINT64_MAX || p->size_max != UINT64_MAX))
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL),
"SizeMinBytes=/SizeMaxBytes= cannot be used with Verity=%s",
"SizeMinBytes=/SizeMaxBytes= cannot be used with Verity=%s.",
verity_mode_to_string(p->verity));
if (!strv_isempty(p->subvolumes) && arg_offline > 0)
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EOPNOTSUPP),
"Subvolumes= cannot be used with --offline=yes");
"Subvolumes= cannot be used with --offline=yes.");
if (p->default_subvolume && arg_offline > 0)
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EOPNOTSUPP),
"DefaultSubvolume= cannot be used with --offline=yes");
"DefaultSubvolume= cannot be used with --offline=yes.");
if (p->default_subvolume && !path_strv_contains(p->subvolumes, p->default_subvolume))
return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL),
"DefaultSubvolume= must be one of the paths in Subvolumes=");
"DefaultSubvolume= must be one of the paths in Subvolumes=.");
/* Verity partitions are read only, let's imply the RO flag hence, unless explicitly configured otherwise. */
if ((IN_SET(p->type.designator,
@ -2165,7 +2165,7 @@ static int determine_current_padding(
assert(ret);
if (!fdisk_partition_has_end(p))
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Partition has no end!");
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Partition has no end.");
offset = fdisk_partition_get_end(p);
assert(offset < UINT64_MAX);
@ -2180,7 +2180,7 @@ static int determine_current_padding(
q = fdisk_table_get_partition(t, i);
if (!q)
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to read partition metadata: %m");
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to read partition metadata.");
if (fdisk_partition_is_used(q) <= 0)
continue;
@ -2266,7 +2266,7 @@ static int context_copy_from_one(Context *context, const char *src) {
p = fdisk_table_get_partition(t, i);
if (!p)
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to read partition metadata: %m");
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to read partition metadata.");
if (fdisk_partition_is_used(p) <= 0)
continue;
@ -2416,21 +2416,21 @@ static int context_read_definitions(Context *context) {
if (r == -ENXIO) {
if (mode != VERITY_SIG)
return log_syntax(NULL, LOG_ERR, p->definition_path, 1, SYNTHETIC_ERRNO(EINVAL),
"Missing verity %s partition for verity %s partition with VerityMatchKey=%s",
"Missing verity %s partition for verity %s partition with VerityMatchKey=%s.",
verity_mode_to_string(mode), verity_mode_to_string(p->verity), p->verity_match_key);
} else if (r == -ENOTUNIQ)
return log_syntax(NULL, LOG_ERR, p->definition_path, 1, SYNTHETIC_ERRNO(EINVAL),
"Multiple verity %s partitions found for verity %s partition with VerityMatchKey=%s",
"Multiple verity %s partitions found for verity %s partition with VerityMatchKey=%s.",
verity_mode_to_string(mode), verity_mode_to_string(p->verity), p->verity_match_key);
else if (r < 0)
return log_syntax(NULL, LOG_ERR, p->definition_path, 1, r,
"Failed to find verity %s partition for verity %s partition with VerityMatchKey=%s",
"Failed to find verity %s partition for verity %s partition with VerityMatchKey=%s.",
verity_mode_to_string(mode), verity_mode_to_string(p->verity), p->verity_match_key);
if (q) {
if (q->priority != p->priority)
return log_syntax(NULL, LOG_ERR, p->definition_path, 1, SYNTHETIC_ERRNO(EINVAL),
"Priority mismatch (%i != %i) for verity sibling partitions with VerityMatchKey=%s",
"Priority mismatch (%i != %i) for verity sibling partitions with VerityMatchKey=%s.",
p->priority, q->priority, p->verity_match_key);
p->siblings[mode] = q;
@ -2451,8 +2451,7 @@ static int context_read_definitions(Context *context) {
if (dp->minimize == MINIMIZE_OFF && !(dp->copy_blocks_path || dp->copy_blocks_auto))
return log_syntax(NULL, LOG_ERR, p->definition_path, 1, SYNTHETIC_ERRNO(EINVAL),
"Minimize= set for verity hash partition but data partition does "
"not set CopyBlocks= or Minimize=");
"Minimize= set for verity hash partition but data partition does not set CopyBlocks= or Minimize=.");
}
@ -2731,7 +2730,7 @@ static int context_load_partition_table(Context *context) {
p = fdisk_table_get_partition(t, i);
if (!p)
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to read partition metadata: %m");
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to read partition metadata.");
if (fdisk_partition_is_used(p) <= 0)
continue;
@ -3899,7 +3898,7 @@ static int partition_target_sync(Context *context, Partition *p, PartitionTarget
if (st.st_size > (off_t) p->new_size)
return log_error_errno(SYNTHETIC_ERRNO(ENOSPC),
"Partition %" PRIu64 "'s contents (%s) don't fit in the partition (%s)",
"Partition %" PRIu64 "'s contents (%s) don't fit in the partition (%s).",
p->partno, FORMAT_BYTES(st.st_size), FORMAT_BYTES(p->new_size));
r = copy_bytes(t->fd, whole_fd, UINT64_MAX, COPY_REFLINK|COPY_HOLES|COPY_FSYNC);
@ -4261,7 +4260,7 @@ static int partition_encrypt(Context *context, Partition *p, PartitionTarget *ta
return 0;
#else
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
"libcryptsetup is not supported or is missing required symbols, cannot encrypt: %m");
"libcryptsetup is not supported or is missing required symbols, cannot encrypt.");
#endif
}
@ -4382,7 +4381,7 @@ static int partition_format_verity_hash(
return 0;
#else
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "libcryptsetup is not supported, cannot setup verity hashes: %m");
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "libcryptsetup is not supported, cannot setup verity hashes.");
#endif
}
@ -4423,7 +4422,7 @@ static int sign_verity_roothash(
return 0;
#else
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "OpenSSL is not supported, cannot setup verity signature: %m");
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "OpenSSL is not supported, cannot setup verity signature.");
#endif
}
@ -4478,7 +4477,7 @@ static int partition_format_verity_sig(Context *context, Partition *p) {
return log_error_errno(r, "Failed to format verity signature JSON object: %m");
if (strlen(text)+1 > p->new_size)
return log_error_errno(SYNTHETIC_ERRNO(E2BIG), "Verity signature too long for partition: %m");
return log_error_errno(SYNTHETIC_ERRNO(E2BIG), "Verity signature too long for partition.");
r = strgrowpad0(&text, p->new_size);
if (r < 0)
@ -5721,7 +5720,7 @@ static int split_name_resolve(Context *context) {
continue;
return log_error_errno(SYNTHETIC_ERRNO(ENOTUNIQ),
"%s and %s have the same resolved split name \"%s\", refusing",
"%s and %s have the same resolved split name \"%s\", refusing.",
p->definition_path, q->definition_path, p->split_path);
}
}
@ -6316,7 +6315,7 @@ static int context_open_copy_block_paths(
if (r < 0)
return log_error_errno(r, "Failed to determine size of block device to copy from: %m");
} else
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Specified path to copy blocks from '%s' is not a regular file, block device or directory, refusing: %m", opened);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Specified path to copy blocks from '%s' is not a regular file, block device or directory, refusing.", opened);
if (size <= 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "File to copy bytes from '%s' has zero size, refusing.", opened);
@ -6635,7 +6634,7 @@ static int context_minimize(Context *context) {
if (!d || fstype_is_ro(p->format)) {
if (!mkfs_supports_root_option(p->format))
return log_error_errno(SYNTHETIC_ERRNO(ENODEV),
"Loop device access is required to populate %s filesystems",
"Loop device access is required to populate %s filesystems.",
p->format);
r = partition_populate_directory(context, p, &root);
@ -7340,7 +7339,7 @@ static int parse_argv(int argc, char *argv[]) {
case ARG_ARCHITECTURE:
r = architecture_from_string(optarg);
if (r < 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid architecture '%s'", optarg);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid architecture '%s'.", optarg);
arg_architecture = r;
break;

View File

@ -576,7 +576,7 @@ static int event_log_record_extract_firmware_description(EventLogRecord *rec) {
case EV_SEPARATOR: {
if (rec->firmware_payload_size != sizeof(uint32_t)) {
log_warning_errno(SYNTHETIC_ERRNO(EBADMSG), "EFI separator field has wrong size, ignoring.");
log_warning("EFI separator field has wrong size, ignoring.");
goto invalid;
}
@ -594,7 +594,7 @@ static int event_log_record_extract_firmware_description(EventLogRecord *rec) {
break;
default:
log_warning_errno(SYNTHETIC_ERRNO(EBADMSG), "Unexpected separator payload %" PRIu32 ".", val);
log_warning("Unexpected separator payload %" PRIu32 ", ignoring.", val);
goto invalid;
}
@ -612,7 +612,7 @@ static int event_log_record_extract_firmware_description(EventLogRecord *rec) {
return log_error_errno(r, "Failed to make C string from EFI action string: %m");
if (!string_is_safe(d)) {
log_warning_errno(SYNTHETIC_ERRNO(EBADMSG), "Unsafe EFI action string in record, ignoring.");
log_warning("Unsafe EFI action string in record, ignoring.");
goto invalid;
}
@ -624,14 +624,14 @@ static int event_log_record_extract_firmware_description(EventLogRecord *rec) {
case EV_EFI_GPT_EVENT: {
if (rec->firmware_payload_size < sizeof(GptHeader)) {
log_warning_errno(SYNTHETIC_ERRNO(EBADMSG), "GPT measurement too short, ignoring.");
log_warning("GPT measurement too short, ignoring.");
goto invalid;
}
const GptHeader *h = rec->firmware_payload;
if (!gpt_header_has_signature(h)) {
log_warning_errno(SYNTHETIC_ERRNO(EBADMSG), "GPT measurement does not cover a GPT partition table header, ignoring.");
log_warning("GPT measurement does not cover a GPT partition table header, ignoring.");
goto invalid;
}
@ -655,7 +655,7 @@ static int event_log_record_extract_firmware_description(EventLogRecord *rec) {
return log_oom();
if (string_has_cc(d, NULL)) {
log_warning_errno(SYNTHETIC_ERRNO(EBADMSG), "Unsafe EFI action string in record, ignoring.");
log_warning("Unsafe EFI action string in record, ignoring.");
goto invalid;
}
@ -671,7 +671,7 @@ static int event_log_record_extract_firmware_description(EventLogRecord *rec) {
size_t left = rec->firmware_payload_size;
if (left == 0) {
log_warning_errno(SYNTHETIC_ERRNO(EBADMSG), "Empty tagged PC client event, ignoring.");
log_warning("Empty tagged PC client event, ignoring.");
goto invalid;
}
@ -679,13 +679,13 @@ static int event_log_record_extract_firmware_description(EventLogRecord *rec) {
uint64_t m;
if (left < offsetof(TCG_PCClientTaggedEvent, taggedEventData)) {
log_warning_errno(SYNTHETIC_ERRNO(EBADMSG), "Tagged PC client event too short, ignoring.");
log_warning("Tagged PC client event too short, ignoring.");
goto invalid;
}
m = offsetof(TCG_PCClientTaggedEvent, taggedEventData) + (uint64_t) tag->taggedEventDataSize;
if (left < m) {
log_warning_errno(SYNTHETIC_ERRNO(EBADMSG), "Tagged PC client event data too short, ignoring.");
log_warning("Tagged PC client event data too short, ignoring.");
goto invalid;
}
@ -755,7 +755,7 @@ static int event_log_record_extract_firmware_description(EventLogRecord *rec) {
case EV_EFI_PLATFORM_FIRMWARE_BLOB: {
const UEFI_PLATFORM_FIRMWARE_BLOB *blob;
if (rec->firmware_payload_size != sizeof(UEFI_PLATFORM_FIRMWARE_BLOB)) {
log_warning_errno(SYNTHETIC_ERRNO(EBADMSG), "EV_EFI_PLATFORM_FIRMWARE_BLOB of wrong size, ignoring.");
log_warning("EV_EFI_PLATFORM_FIRMWARE_BLOB of wrong size, ignoring.");
goto invalid;
}
@ -774,14 +774,14 @@ static int event_log_record_extract_firmware_description(EventLogRecord *rec) {
bool end = false;
if (rec->firmware_payload_size < offsetof(UEFI_IMAGE_LOAD_EVENT, devicePath)) {
log_warning_errno(SYNTHETIC_ERRNO(EBADMSG), "Device path too short, ignoring.");
log_warning("Device path too short, ignoring.");
goto invalid;
}
load = rec->firmware_payload;
if (load->lengthOfDevicePath !=
rec->firmware_payload_size - offsetof(UEFI_IMAGE_LOAD_EVENT, devicePath)) {
log_warning_errno(SYNTHETIC_ERRNO(EBADMSG), "Device path size does not match, ignoring.");
log_warning("Device path size does not match, ignoring.");
goto invalid;
}
@ -791,7 +791,7 @@ static int event_log_record_extract_firmware_description(EventLogRecord *rec) {
for (;;) {
if (left == 0) {
if (!end) {
log_warning_errno(SYNTHETIC_ERRNO(EBADMSG), "Garbage after device path end, ignoring.");
log_warning("Garbage after device path end, ignoring.");
goto invalid;
}
@ -799,12 +799,12 @@ static int event_log_record_extract_firmware_description(EventLogRecord *rec) {
}
if (end) {
log_warning_errno(SYNTHETIC_ERRNO(EBADMSG), "Garbage after device path end, ignoring.");
log_warning("Garbage after device path end, ignoring.");
goto invalid;
}
if (left < offsetof(packed_EFI_DEVICE_PATH, path) || left < dp->length) {
log_warning_errno(SYNTHETIC_ERRNO(EBADMSG), "Device path element too short, ignoring.");
log_warning("Device path element too short, ignoring.");
goto invalid;
}
@ -923,7 +923,7 @@ static int event_log_load_firmware(EventLog *el) {
payload_size == 17 &&
memcmp(payload, "StartupLocality", sizeof("StartupLocality")) == 0) {
if (el->startup_locality_found)
return log_error_errno(SYNTHETIC_ERRNO(EBADMSG), "StartupLocality event found twice!");
return log_error_errno(SYNTHETIC_ERRNO(EBADMSG), "StartupLocality event found twice.");
el->startup_locality = ((const uint8_t*) payload)[sizeof("StartupLocality")];
el->startup_locality_found = true;
@ -1044,7 +1044,7 @@ static int event_log_record_parse_json(EventLogRecord *record, JsonVariant *j) {
h = json_variant_by_key(k, "digest");
if (!h)
return log_error_errno(SYNTHETIC_ERRNO(EBADMSG), "'digests' field lacks 'digest' field");
return log_error_errno(SYNTHETIC_ERRNO(EBADMSG), "'digests' field lacks 'digest' field.");
r = json_variant_unhex(h, &hash, &hash_size);
if (r < 0)
@ -1328,7 +1328,7 @@ static int event_log_calculate_pcrs(EventLog *el) {
rec_b = event_log_record_find_bank(*rr, el->algorithms[i]);
if (!rec_b) {
log_warning_errno(SYNTHETIC_ERRNO(ENXIO), "Record with missing bank '%s', ignoring.", n);
log_warning("Record with missing bank '%s', ignoring.", n);
continue;
}
@ -2749,7 +2749,7 @@ static int make_pcrlock_record_from_stream(
n = fread(buffer, 1, sizeof(buffer), f);
if (ferror(f))
return log_error_errno(SYNTHETIC_ERRNO(ENOTRECOVERABLE), "Failed to read file: %m");
return log_error_errno(SYNTHETIC_ERRNO(ENOTRECOVERABLE), "Failed to read file.");
if (n == 0 && feof(f))
break;
@ -3195,7 +3195,7 @@ static int verb_lock_gpt(int argc, char *argv[], void *userdata) {
if (n < 0)
return log_error_errno(errno, "Failed to read GPT header of block device: %m");
if ((size_t) n != sizeof(h))
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Short read trying to read GPT header: %m");
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Short read trying to read GPT header.");
/* Try a couple of sector sizes */
for (size_t sz = 512; sz <= 4096; sz <<= 1) {
@ -3248,7 +3248,7 @@ static int verb_lock_gpt(int argc, char *argv[], void *userdata) {
if (n < 0)
return log_error_errno(errno, "Failed to read GPT partition table entries: %m");
if ((size_t) n != member_bufsz)
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Short read while reading GPT partition table entries: %m");
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Short read while reading GPT partition table entries.");
size_t vdata_size = le32toh(p->header_size) + sizeof(le64_t) + member_size * n_members;
_cleanup_free_ void *vdata = malloc0(vdata_size);

View File

@ -494,14 +494,14 @@ static int bus_append_nft_set(sd_bus_message *m, const char *field, const char *
if (r == 0)
break;
if (isempty(tuple))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse %s", field);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse %s.", field);
q = tuple;
r = extract_many_words(&q, ":", EXTRACT_CUNESCAPE, &source_str, &nfproto_str, &table, &set);
if (r == -ENOMEM)
return log_oom();
if (r != 4 || !isempty(q))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse %s", field);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse %s.", field);
assert(source_str);
assert(nfproto_str);
@ -510,11 +510,11 @@ static int bus_append_nft_set(sd_bus_message *m, const char *field, const char *
source = nft_set_source_from_string(source_str);
if (!IN_SET(source, NFT_SET_SOURCE_CGROUP, NFT_SET_SOURCE_USER, NFT_SET_SOURCE_GROUP))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse %s", field);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse %s.", field);
nfproto = nfproto_from_string(nfproto_str);
if (nfproto < 0 || !nft_identifier_valid(table) || !nft_identifier_valid(set))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse %s", field);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse %s.", field);
r = sd_bus_message_append(m, "(iiss)", source, nfproto, table, set);
if (r < 0)
@ -679,8 +679,7 @@ static int bus_append_cgroup_property(sd_bus_message *m, const char *field, cons
else {
r = parse_permyriad_unbounded(eq);
if (r == 0)
return log_error_errno(SYNTHETIC_ERRNO(ERANGE),
"CPU quota too small.");
return log_error_errno(SYNTHETIC_ERRNO(ERANGE), "CPU quota too small.");
if (r < 0)
return log_error_errno(r, "CPU quota '%s' invalid.", eq);
@ -1792,7 +1791,7 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con
if (r < 0)
return log_error_errno(r, "Failed to decode RootHash= '%s': %m", eq);
if (roothash_decoded_size < sizeof(sd_id128_t))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "RootHash= '%s' is too short: %m", eq);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "RootHash= '%s' is too short.", eq);
return bus_append_byte_array(m, field, roothash_decoded, roothash_decoded_size);
}
@ -1807,7 +1806,7 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con
return bus_append_string(m, "RootHashSignaturePath", eq);
if (!(value = startswith(eq, "base64:")))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to decode RootHashSignature= '%s', not a path but doesn't start with 'base64:': %m", eq);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to decode RootHashSignature= '%s', not a path but doesn't start with 'base64:'.", eq);
/* We have a roothash signature to decode, eg: RootHashSignature=base64:012345789abcdef */
r = unbase64mem(value, &roothash_sig_decoded, &roothash_sig_decoded_size);

View File

@ -260,13 +260,13 @@ static int condition_test_osrelease(Condition *c, char **env) {
/* The os-release spec mandates env-var-like key names */
if (r == 0 || isempty(word) || !env_name_is_valid(key))
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL),
"Failed to parse parameter, key/value format expected: %m");
"Failed to parse parameter, key/value format expected.");
/* Do not allow whitespace after the separator, as that's not a valid os-release format */
operator = parse_compare_operator(&word, COMPARE_ALLOW_FNMATCH|COMPARE_EQUAL_BY_STRING);
if (operator < 0 || isempty(word) || strchr(WHITESPACE, *word) != NULL)
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL),
"Failed to parse parameter, key/value format expected: %m");
"Failed to parse parameter, key/value format expected.");
r = parse_os_release(NULL, key, &actual_value);
if (r < 0)
@ -543,7 +543,7 @@ static int condition_test_firmware_smbios_field(const char *expression) {
/* Read actual value from sysfs */
if (!filename_is_valid(field))
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid SMBIOS field name");
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid SMBIOS field name.");
const char *p = strjoina("/sys/class/dmi/id/", field);
r = read_virtual_file(p, SIZE_MAX, &actual_value, NULL);
@ -599,7 +599,7 @@ static int condition_test_firmware(Condition *c, char **env) {
end = strrchr(arg, ')');
if (!end || *(end + 1) != '\0')
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Malformed ConditionFirmware=%s: %m", c->parameter);
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Malformed ConditionFirmware=%s.", c->parameter);
smbios_arg = strndup(arg, end - arg);
if (!smbios_arg)
@ -1046,7 +1046,7 @@ static int condition_test_psi(Condition *c, char **env) {
slice = strstrip(first);
if (!slice)
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse condition parameter %s: %m", c->parameter);
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse condition parameter %s.", c->parameter);
r = cg_all_unified();
if (r < 0)
@ -1109,7 +1109,7 @@ static int condition_test_psi(Condition *c, char **env) {
timespan = skip_leading_chars(fourth, NULL);
if (!timespan)
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse condition parameter %s: %m", c->parameter);
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse condition parameter %s.", c->parameter);
if (startswith(timespan, "10sec"))
current = &pressure.avg10;
@ -1118,12 +1118,12 @@ static int condition_test_psi(Condition *c, char **env) {
else if (startswith(timespan, "5min"))
current = &pressure.avg300;
else
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse condition parameter %s: %m", c->parameter);
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse condition parameter %s.", c->parameter);
}
value = strstrip(third);
if (!value)
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse condition parameter %s: %m", c->parameter);
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse condition parameter %s.", c->parameter);
r = parse_permyriad(value);
if (r < 0)

View File

@ -555,7 +555,7 @@ int get_credential_host_secret(CredentialSecretFlags flags, struct iovec *ret) {
"Failed to read %s/%s: %m", dirname, filename);
if ((size_t) n != l) /* What? The size changed? */
return log_debug_errno(SYNTHETIC_ERRNO(EIO),
"Failed to read %s/%s: %m", dirname, filename);
"Failed to read %s/%s.", dirname, filename);
if (sd_id128_equal(machine_id, f->machine_id)) {
size_t sz;
@ -1210,7 +1210,7 @@ int decrypt_credential_and_warn(
with_scope = sd_id128_in_set(h->id, CRED_AES256_GCM_BY_HOST_SCOPED, CRED_AES256_GCM_BY_HOST_AND_TPM2_HMAC_SCOPED, CRED_AES256_GCM_BY_HOST_AND_TPM2_HMAC_WITH_PK_SCOPED);
if (!with_host_key && !with_tpm2 && !with_null)
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "Unknown encryption format, or corrupted data: %m");
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "Unknown encryption format, or corrupted data.");
if (with_tpm2_pk) {
r = tpm2_load_pcr_signature(tpm2_signature_path, &signature_json);

View File

@ -93,7 +93,7 @@ static int nscd_flush_cache_one(const char *database, usec_t end) {
ssize_t m;
if (has_read >= sizeof(resp))
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "Response from nscd longer than expected: %m");
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "Response from nscd longer than expected.");
m = recv(fd, (uint8_t*) &resp + has_read, sizeof(resp) - has_read, 0);
if (m < 0) {

View File

@ -1302,7 +1302,7 @@ int pkey_generate_volume_keys(
return ecc_pkey_generate_volume_keys(pkey, ret_decrypted_key, ret_decrypted_key_size, ret_saved_key, ret_saved_key_size);
case NID_undef:
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to determine a type of public key");
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to determine a type of public key.");
default:
return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "Unsupported public key type: %s", OBJ_nid2sn(type));
@ -1416,7 +1416,7 @@ int x509_fingerprint(X509 *cert, uint8_t buffer[static SHA256_DIGEST_SIZE]) {
sha256_direct(der, dersz, buffer);
return 0;
#else
return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "OpenSSL is not supported, cannot calculate X509 fingerprint: %m");
return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "OpenSSL is not supported, cannot calculate X509 fingerprint.");
#endif
}

View File

@ -101,7 +101,7 @@ int pcrextend_file_system_word(const char *path, char **ret_word, char **ret_nor
if (r < 0)
return log_error_errno(r, "Failed to determine if path '%s' is mount point: %m", normalized_path);
if (r == 0)
return log_error_errno(SYNTHETIC_ERRNO(ENOTDIR), "Specified path '%s' is not a mount point, refusing: %m", normalized_path);
return log_error_errno(SYNTHETIC_ERRNO(ENOTDIR), "Specified path '%s' is not a mount point, refusing.", normalized_path);
normalized_escaped = xescape(normalized_path, ":"); /* Avoid ambiguity around ":" */
if (!normalized_escaped)

View File

@ -338,7 +338,7 @@ static int open_watchdog(void) {
}
if (watchdog_fd < 0)
return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Failed to open watchdog device %s: %m", watchdog_device ?: "auto");
return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Failed to open watchdog device %s.", watchdog_device ?: "auto");
if (ioctl(watchdog_fd, WDIOC_GETSUPPORT, &ident) < 0)
log_debug_errno(errno, "Hardware watchdog %s does not support WDIOC_GETSUPPORT ioctl, ignoring: %m", watchdog_device);

View File

@ -142,7 +142,7 @@ static int get_battery_discharge_rate(sd_device *dev, int *ret) {
return log_device_debug_errno(dev, r, "Failed to parse discharge rate read from " DISCHARGE_RATE_FILEPATH ": %m");
if (!battery_discharge_rate_is_valid(discharge_rate))
return log_device_debug_errno(dev, SYNTHETIC_ERRNO(ERANGE), "Invalid battery discharge percentage rate per hour: %m");
return log_device_debug_errno(dev, SYNTHETIC_ERRNO(ERANGE), "Invalid battery discharge percentage rate per hour.");
*ret = discharge_rate;
return 0; /* matching device found, exit iteration */
@ -157,7 +157,7 @@ static int put_battery_discharge_rate(int estimated_battery_discharge_rate, uint
if (!battery_discharge_rate_is_valid(estimated_battery_discharge_rate))
return log_debug_errno(SYNTHETIC_ERRNO(ERANGE),
"Invalid battery discharge rate %d%% per hour: %m",
"Invalid battery discharge rate %d%% per hour.",
estimated_battery_discharge_rate);
r = write_string_filef(

View File

@ -40,7 +40,7 @@ int read_partition_info(
p = fdisk_table_get_partition(t, i);
if (!p)
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to read partition metadata: %m");
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to read partition metadata.");
if (fdisk_partition_is_used(p) <= 0) {
*ret = (PartitionInfo) PARTITION_INFO_NULL;

View File

@ -104,7 +104,7 @@ static int setup_tests(bool *run_ambient) {
nobody = getpwnam(NOBODY_USER_NAME);
if (!nobody)
return log_warning_errno(SYNTHETIC_ERRNO(ENOENT), "Couldn't find 'nobody' user: %m");
return log_warning_errno(SYNTHETIC_ERRNO(ENOENT), "Couldn't find 'nobody' user.");
test_uid = nobody->pw_uid;
test_gid = nobody->pw_gid;

View File

@ -86,14 +86,14 @@ static int disk_scsi_inquiry_command(
if (io_hdr.status != 0 ||
io_hdr.host_status != 0 ||
io_hdr.driver_status != 0)
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v3 failed");
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v3 failed.");
} else {
/* even if the ioctl succeeds, we need to check the return value */
if (io_v4.device_status != 0 ||
io_v4.transport_status != 0 ||
io_v4.driver_status != 0)
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v4 failed");
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v4 failed.");
}
return 0;
@ -160,7 +160,7 @@ static int disk_identify_command(
} else {
if (!((sense[0] & 0x7f) == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c) &&
!((sense[0] & 0x7f) == 0x70 && sense[12] == 0x00 && sense[13] == 0x1d))
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v4 failed: %m");
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v4 failed.");
}
return 0;
@ -232,7 +232,7 @@ static int disk_identify_packet_device_command(
return log_debug_errno(errno, "ioctl v3 failed: %m");
} else {
if ((sense[0] & 0x7f) != 0x72 || desc[0] != 0x9 || desc[1] != 0x0c)
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v4 failed: %m");
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "ioctl v4 failed.");
}
return 0;

View File

@ -368,7 +368,7 @@ static int builtin_blkid(UdevEvent *event, int argc, char *argv[]) {
if (r < 0)
return log_device_error_errno(dev, r, "Failed to parse '%s' as an integer: %m", optarg);
if (offset < 0)
return log_device_error_errno(dev, SYNTHETIC_ERRNO(EINVAL), "Invalid offset %"PRIi64": %m", offset);
return log_device_error_errno(dev, SYNTHETIC_ERRNO(EINVAL), "Invalid offset %"PRIi64".", offset);
break;
case 'R':
noraid = true;

View File

@ -814,7 +814,7 @@ static int names_devicetree(sd_device *dev, const char *prefix, EventMode mode)
ofnode_path = path_startswith(ofnode_syspath, devicetree_syspath);
if (!ofnode_path)
return log_device_debug_errno(ofnode_dev, SYNTHETIC_ERRNO(EINVAL),
"The device '%s' is not a child device of '%s': %m",
"The device '%s' is not a child device of '%s'.",
ofnode_syspath, devicetree_syspath);
/* Get back our leading / to match the contents of the aliases */
@ -855,7 +855,7 @@ static int names_devicetree(sd_device *dev, const char *prefix, EventMode mode)
/* ...but make sure we don't have an alias conflict */
if (i == 0 && device_get_sysattr_value_filtered(aliases_dev, conflict, NULL) >= 0)
return log_device_debug_errno(dev, SYNTHETIC_ERRNO(EEXIST),
"Ethernet alias conflict: ethernet and ethernet0 both exist");
"Ethernet alias conflict: ethernet and ethernet0 both exist.");
char str[ALTIFNAMSIZ];
if (snprintf_ok(str, sizeof str, "%sd%u", prefix, i))
@ -1232,7 +1232,7 @@ static int names_xen(sd_device *dev, const char *prefix, EventMode mode) {
p = startswith(vif, "vif-");
if (!p)
return log_device_debug_errno(dev, SYNTHETIC_ERRNO(EINVAL), "Invalid vif name: %s: %m", vif);
return log_device_debug_errno(dev, SYNTHETIC_ERRNO(EINVAL), "Invalid vif name: %s.", vif);
r = safe_atou_full(p, SAFE_ATO_REFUSE_PLUS_MINUS | SAFE_ATO_REFUSE_LEADING_ZERO |
SAFE_ATO_REFUSE_LEADING_WHITESPACE | 10, &id);

View File

@ -126,7 +126,7 @@ static int parse_argv(int argc, char *argv[]) {
if (arg_print) {
if (optind != argc)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "No arguments expected");
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "No arguments expected.");
} else {
if (optind + 1 > argc)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Too few arguments, command to execute.");
@ -193,7 +193,7 @@ static int lock_device(
/* Extra safety: check that the device still refers to what we think it refers to */
if (!S_ISBLK(st.st_mode) || st.st_rdev != devno)
return log_error_errno(SYNTHETIC_ERRNO(ENXIO), "Path '%s' no longer refers to specified block device %u:%u: %m", path, major(devno), minor(devno));
return log_error_errno(SYNTHETIC_ERRNO(ENXIO), "Path '%s' no longer refers to specified block device %u:%u.", path, major(devno), minor(devno));
r = lock_generic(fd, LOCK_BSD, LOCK_EX|LOCK_NB);
if (r < 0) {