tree-wide: do not use %m with SYNTHETIC_ERRNO()
This commit is contained in:
@@ -291,7 +291,7 @@ static int files_add(
|
||||
|
||||
if (need_stat) {
|
||||
/* If we need to have stat, skip the entry. */
|
||||
log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Failed to chase '%s/%s', ignoring: %m",
|
||||
log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Failed to chase '%s/%s', ignoring.",
|
||||
root, skip_leading_slash(original_path));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1777,7 +1777,7 @@ int vt_restore(int fd) {
|
||||
assert(fd >= 0);
|
||||
|
||||
if (!isatty_safe(fd))
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(ENOTTY), "Asked to restore the VT for an fd that does not refer to a terminal: %m");
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(ENOTTY), "Asked to restore the VT for an fd that does not refer to a terminal.");
|
||||
|
||||
if (ioctl(fd, KDSETMODE, KD_TEXT) < 0)
|
||||
RET_GATHER(ret, log_debug_errno(errno, "Failed to set VT to text mode, ignoring: %m"));
|
||||
@@ -1804,7 +1804,7 @@ int vt_release(int fd, bool restore) {
|
||||
* VT-switching modes. */
|
||||
|
||||
if (!isatty_safe(fd))
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(ENOTTY), "Asked to release the VT for an fd that does not refer to a terminal: %m");
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(ENOTTY), "Asked to release the VT for an fd that does not refer to a terminal.");
|
||||
|
||||
if (ioctl(fd, VT_RELDISP, 1) < 0)
|
||||
return -errno;
|
||||
|
||||
@@ -236,7 +236,7 @@ static int acquire_boot_count_path(
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to extract filename from LoaderBootCountPath '%s': %m", path);
|
||||
if (r == 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EADDRNOTAVAIL), "LoaderBootCountPath '%s' refers to the root directory: %m", path);
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EADDRNOTAVAIL), "LoaderBootCountPath '%s' refers to the root directory.", path);
|
||||
if (strlen(last) > (size_t) r)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EISDIR), "LoaderBootCountPath '%s' refers to directory path, refusing.", path);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ static int random_seed_verify_permissions(int fd, mode_t expected_type) {
|
||||
|
||||
if (((st.st_mode ^ expected_type) & S_IFMT) != 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EBADF),
|
||||
"Unexpected inode type when validating random seed access mode on %s: %m", full_path);
|
||||
"Unexpected inode type when validating random seed access mode on '%s'.", full_path);
|
||||
|
||||
if ((st.st_mode & 0007) == 0) /* All world bits are off? Then all is good */
|
||||
return 0;
|
||||
|
||||
@@ -211,7 +211,7 @@ int bpf_restrict_ifaces_supported(void) {
|
||||
|
||||
int bpf_restrict_ifaces_install(Unit *u) {
|
||||
return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EOPNOTSUPP),
|
||||
"restrict-interfaces: Failed to install; BPF programs built from source code are not supported: %m");
|
||||
"restrict-interfaces: Failed to install; BPF programs built from source code are not supported.");
|
||||
}
|
||||
|
||||
int bpf_restrict_ifaces_serialize(Unit *u, FILE *f, FDSet *fds) {
|
||||
|
||||
@@ -2791,7 +2791,7 @@ static int apply_exec_quotas(
|
||||
#define MAX_PROJ_ID_RETRIES 10
|
||||
for (unsigned attempt = 0;; attempt++) {
|
||||
if (attempt >= MAX_PROJ_ID_RETRIES)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EBUSY), "Failed to generate unique project ID for %s: %m", target_dir);
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EBUSY), "Failed to generate unique project ID for '%s'.", target_dir);
|
||||
|
||||
/* Check if project quotas are supported */
|
||||
struct dqblk req;
|
||||
@@ -4608,7 +4608,7 @@ static int setup_delegated_namespaces(
|
||||
exec_namespace_is_delegated(context, params, have_cap_sys_admin, CLONE_NEWPID) == delegate) {
|
||||
if (params->pidref_transport_fd < 0) {
|
||||
*reterr_exit_status = EXIT_NAMESPACE;
|
||||
return log_error_errno(SYNTHETIC_ERRNO(ENOTCONN), "PidRef socket is not set up: %m");
|
||||
return log_error_errno(SYNTHETIC_ERRNO(ENOTCONN), "PidRef socket is not set up.");
|
||||
}
|
||||
|
||||
/* If we had CAP_SYS_ADMIN prior to joining the user namespace, then we are privileged and don't need
|
||||
|
||||
@@ -79,7 +79,7 @@ int mac_selinux_setup(bool *loaded_policy) {
|
||||
if (enforce > 0) {
|
||||
if (!initialized)
|
||||
return log_struct_errno(LOG_EMERG, SYNTHETIC_ERRNO(EIO),
|
||||
LOG_MESSAGE("Failed to load SELinux policy: %m"),
|
||||
LOG_MESSAGE("Failed to load SELinux policy."),
|
||||
LOG_MESSAGE_ID(SD_MESSAGE_SELINUX_FAILED_STR));
|
||||
|
||||
log_notice("Failed to load new SELinux policy. Continuing with old policy.");
|
||||
|
||||
+1
-1
@@ -5227,7 +5227,7 @@ static int verb_list_signing_keys(int argc, char *argv[], void *userdata) {
|
||||
_cleanup_free_ void *der = NULL;
|
||||
int n = i2d_PUBKEY(key, (unsigned char**) &der);
|
||||
if (n < 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(ENOTRECOVERABLE), "Failed to encode key as DER: %m");
|
||||
return log_error_errno(SYNTHETIC_ERRNO(ENOTRECOVERABLE), "Failed to encode key as DER.");
|
||||
|
||||
ssize_t m = base64mem(der, MIN(n, 64), &h);
|
||||
if (m < 0)
|
||||
|
||||
@@ -1227,7 +1227,7 @@ static int open_image_file(
|
||||
if (!S_ISREG(st.st_mode) && !S_ISBLK(st.st_mode))
|
||||
return log_error_errno(
|
||||
S_ISDIR(st.st_mode) ? SYNTHETIC_ERRNO(EISDIR) : SYNTHETIC_ERRNO(EBADFD),
|
||||
"Image file %s is not a regular file or block device: %m", ip);
|
||||
"Image file %s is not a regular file or block device.", ip);
|
||||
|
||||
/* Locking block devices doesn't really make sense, as this might interfere with
|
||||
* udev's workings, and these locks aren't network propagated anyway, hence not what
|
||||
|
||||
@@ -63,14 +63,14 @@ static int parse_pull_expression(const char *v) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to extract option string from pull expression '%s': %m", v);
|
||||
if (r == 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "No option string in pull expression '%s': %m", v);
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "No option string in pull expression '%s'.", v);
|
||||
|
||||
_cleanup_free_ char *local = NULL;
|
||||
r = extract_first_word(&p, &local, ":", EXTRACT_DONT_COALESCE_SEPARATORS);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to extract local name from pull expression '%s': %m", v);
|
||||
if (r == 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "No local string in pull expression '%s': %m", v);
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "No local string in pull expression '%s'.", v);
|
||||
|
||||
_cleanup_free_ char *remote = strdup(p);
|
||||
if (!remote)
|
||||
|
||||
@@ -274,7 +274,7 @@ static int import_tar(int argc, char *argv[], void *userdata) {
|
||||
return log_error_errno(r, "Cannot extract container name from filename: %m");
|
||||
if (r == O_DIRECTORY)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EISDIR),
|
||||
"Path '%s' refers to directory, but we need a regular file: %m", path);
|
||||
"Path '%s' refers to directory, but we need a regular file.", path);
|
||||
|
||||
local = fn;
|
||||
}
|
||||
@@ -353,7 +353,7 @@ static int import_raw(int argc, char *argv[], void *userdata) {
|
||||
return log_error_errno(r, "Cannot extract container name from filename: %m");
|
||||
if (r == O_DIRECTORY)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EISDIR),
|
||||
"Path '%s' refers to directory, but we need a regular file: %m", path);
|
||||
"Path '%s' refers to directory, but we need a regular file.", path);
|
||||
|
||||
local = fn;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ int client_context_read_log_filter_patterns(ClientContext *c, const char *cgroup
|
||||
const char *deny_list_xattr = memchr(xattr, (char)0xff, xattr_size);
|
||||
if (!deny_list_xattr)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG),
|
||||
"Missing delimiter in cgroup user.journald_log_filter_patterns attribute: %m");
|
||||
"Missing delimiter in cgroup user.journald_log_filter_patterns attribute.");
|
||||
|
||||
_cleanup_set_free_ Set *allow_list = NULL;
|
||||
r = client_parse_log_filter_nulstr(xattr, deny_list_xattr - xattr, &allow_list);
|
||||
|
||||
@@ -61,14 +61,14 @@ int ndisc_redirect_parse(sd_ndisc *nd, sd_ndisc_redirect *rd) {
|
||||
* The ICMP Destination Address field in the redirect message does not contain a multicast address. */
|
||||
if (in6_addr_is_null(&rd->destination_address) || in6_addr_is_multicast(&rd->destination_address))
|
||||
return log_ndisc_errno(nd, SYNTHETIC_ERRNO(EBADMSG),
|
||||
"Received Redirect message with an invalid destination address, ignoring datagram: %m");
|
||||
"Received Redirect message with an invalid destination address, ignoring datagram.");
|
||||
|
||||
/* RFC 4861 section 8.1
|
||||
* The ICMP Target Address is either a link-local address (when redirected to a router) or the same
|
||||
* as the ICMP Destination Address (when redirected to the on-link destination). */
|
||||
if (!in6_addr_is_link_local(&rd->target_address) && !in6_addr_equal(&rd->target_address, &rd->destination_address))
|
||||
return log_ndisc_errno(nd, SYNTHETIC_ERRNO(EBADMSG),
|
||||
"Received Redirect message with an invalid target address, ignoring datagram: %m");
|
||||
"Received Redirect message with an invalid target address, ignoring datagram.");
|
||||
|
||||
r = ndisc_parse_options(rd->packet, &rd->options);
|
||||
if (r < 0)
|
||||
|
||||
@@ -309,7 +309,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
|
||||
if (hw_addr.length != sizeof(struct ether_addr))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
|
||||
"Unsupported hardware address length %zu: %m",
|
||||
"Unsupported hardware address length %zu.",
|
||||
hw_addr.length);
|
||||
|
||||
arg_source_mac = hw_addr.ether;
|
||||
|
||||
@@ -85,11 +85,11 @@ int bus_container_connect_socket(sd_bus *b) {
|
||||
if (n > 0) {
|
||||
if (n != sizeof(error_buf))
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EIO),
|
||||
"Read error status of unexpected length %zd from (sd-buscntr): %m", n);
|
||||
"Read error status of unexpected length %zd from (sd-buscntr).", n);
|
||||
|
||||
if (error_buf < 0)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG),
|
||||
"Got unexpected error status from (sd-buscntr): %m");
|
||||
"Got unexpected error status from (sd-buscntr).");
|
||||
|
||||
if (error_buf == EINPROGRESS)
|
||||
return 1;
|
||||
|
||||
@@ -3480,7 +3480,7 @@ _public_ int sd_varlink_server_add_connection_pair(
|
||||
ucred = *override_ucred;
|
||||
else {
|
||||
if (input_fd != output_fd)
|
||||
return varlink_server_log_errno(server, SYNTHETIC_ERRNO(EOPNOTSUPP), "Cannot determine peer identity of connection with separate input/output, refusing: %m");
|
||||
return varlink_server_log_errno(server, SYNTHETIC_ERRNO(EOPNOTSUPP), "Cannot determine peer identity of connection with separate input/output, refusing.");
|
||||
|
||||
r = getpeercred(input_fd, &ucred);
|
||||
if (r < 0)
|
||||
|
||||
@@ -887,7 +887,7 @@ static int parse_cmdline_ip_interface(Context *context, const char *value) {
|
||||
return log_debug_errno(r < 0 ? r : SYNTHETIC_ERRNO(EINVAL), "Failed to parse interface name in ip=%s: %m", value);
|
||||
|
||||
if (isempty(ifname))
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Missing interface name in ip=%s: %m", value);
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Missing interface name in ip=%s.", value);
|
||||
|
||||
r = extract_first_word(&p, &dhcp_type, ":", EXTRACT_DONT_COALESCE_SEPARATORS);
|
||||
if (r <= 0)
|
||||
|
||||
@@ -998,7 +998,7 @@ static int macsec_read_key_file(NetDev *netdev, SecurityAssociation *sa) {
|
||||
|
||||
if (key_len != MACSEC_KEYID_LEN)
|
||||
return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
|
||||
"Invalid key length (%zu bytes), ignoring: %m", key_len);
|
||||
"Invalid key length (%zu bytes), ignoring.", key_len);
|
||||
|
||||
explicit_bzero_safe(sa->key, sa->key_len);
|
||||
free_and_replace(sa->key, key);
|
||||
|
||||
@@ -272,8 +272,7 @@ int link_update_monitor(Link *l) {
|
||||
else {
|
||||
r = parse_operational_state_range(required_operstate, &l->required_operstate);
|
||||
if (r < 0)
|
||||
ret = log_link_debug_errno(l, SYNTHETIC_ERRNO(EINVAL),
|
||||
"Failed to parse required operational state, ignoring: %m");
|
||||
ret = log_link_debug_errno(l, r, "Failed to parse required operational state, ignoring: %m");
|
||||
}
|
||||
|
||||
r = network_link_get_operational_state(l->ifindex, &l->operational_state);
|
||||
|
||||
@@ -1011,7 +1011,7 @@ static int network_iface_pair_parse(const char* iftype, char ***l, const char *p
|
||||
return log_error_errno(r, "Failed to extract first word in %s parameter: %m", iftype);
|
||||
if (r == 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"Short read while reading %s parameter: %m", iftype);
|
||||
"Short read while reading %s parameter.", iftype);
|
||||
if (!ifname_valid(a))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"%s, interface name not valid: %s", iftype, a);
|
||||
|
||||
@@ -3196,7 +3196,7 @@ int image_filter_parse(const char *s, ImageFilter **ret) {
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Failed to extract designator: %m");
|
||||
if (r != 2 || !isempty(x))
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Unable to split: %m");
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Unable to split: %s", word);
|
||||
|
||||
PartitionDesignator d = partition_designator_from_string(designator);
|
||||
if (d < 0)
|
||||
|
||||
@@ -103,7 +103,7 @@ static int verify_esp_blkid(
|
||||
if (r != 0)
|
||||
return log_full_errno(searching ? LOG_DEBUG : LOG_ERR,
|
||||
SYNTHETIC_ERRNO(searching ? EADDRNOTAVAIL : ENODEV),
|
||||
"No filesystem found on \"%s\": %m", node);
|
||||
"No filesystem found on \"%s\".", node);
|
||||
if (!streq(v, "vfat"))
|
||||
return log_full_errno(searching ? LOG_DEBUG : LOG_ERR,
|
||||
SYNTHETIC_ERRNO(searching ? EADDRNOTAVAIL : ENODEV),
|
||||
@@ -631,7 +631,7 @@ static int verify_xbootldr_blkid(
|
||||
if (r != 0)
|
||||
return log_full_errno(searching ? LOG_DEBUG : LOG_ERR,
|
||||
searching ? SYNTHETIC_ERRNO(EADDRNOTAVAIL) : SYNTHETIC_ERRNO(EIO),
|
||||
"%s: Failed to probe PART_ENTRY_SCHEME: %m", node);
|
||||
"%s: Failed to probe PART_ENTRY_SCHEME.", node);
|
||||
if (streq(type, "gpt")) {
|
||||
|
||||
errno = 0;
|
||||
|
||||
@@ -57,11 +57,11 @@ int varlink_server_deserialize_one(sd_varlink_server *s, const char *value, FDSe
|
||||
|
||||
if (v[n] != ' ')
|
||||
return varlink_server_log_errno(s, SYNTHETIC_ERRNO(EINVAL),
|
||||
"Failed to deserialize sd_varlink_server_socket: %s: %m", value);
|
||||
"Failed to deserialize sd_varlink_server_socket: %s", value);
|
||||
v = startswith(v + n + 1, "varlink-server-socket-fd=");
|
||||
if (!v)
|
||||
return varlink_server_log_errno(s, SYNTHETIC_ERRNO(EINVAL),
|
||||
"Failed to deserialize VarlinkServerSocket fd %s: %m", value);
|
||||
"Failed to deserialize VarlinkServerSocket fd: %s", value);
|
||||
|
||||
n = strcspn(v, " ");
|
||||
buf = strndupa_safe(v, n);
|
||||
@@ -71,7 +71,7 @@ int varlink_server_deserialize_one(sd_varlink_server *s, const char *value, FDSe
|
||||
return varlink_server_log_errno(s, fd, "Unable to parse VarlinkServerSocket varlink-server-socket-fd=%s: %m", buf);
|
||||
if (!fdset_contains(fds, fd))
|
||||
return varlink_server_log_errno(s, SYNTHETIC_ERRNO(EBADF),
|
||||
"VarlinkServerSocket varlink-server-socket-fd= has unknown fd %d: %m", fd);
|
||||
"VarlinkServerSocket varlink-server-socket-fd= has unknown fd: %d", fd);
|
||||
|
||||
ss = new(VarlinkServerSocket, 1);
|
||||
if (!ss)
|
||||
|
||||
+1
-1
@@ -1731,7 +1731,7 @@ static int merge_subprocess(
|
||||
return log_error_errno(r, "Failed to acquire 'os-release' data of OS tree '%s': %m", empty_to_root(arg_root));
|
||||
if (isempty(host_os_release_id))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"'ID' field not found or empty in 'os-release' data of OS tree '%s': %m",
|
||||
"'ID' field not found or empty in 'os-release' data of OS tree '%s'.",
|
||||
empty_to_root(arg_root));
|
||||
|
||||
/* Let's now mount all images */
|
||||
|
||||
@@ -661,7 +661,7 @@ static int link_generate_new_hw_addr(Link *link, struct hw_addr_data *ret) {
|
||||
memcpy(p, &result, len);
|
||||
if (!hw_addr_is_valid(link, &hw_addr))
|
||||
return log_link_warning_errno(link, SYNTHETIC_ERRNO(EINVAL),
|
||||
"Could not generate valid persistent MAC address: %m");
|
||||
"Could not generate valid persistent MAC address.");
|
||||
}
|
||||
|
||||
finalize:
|
||||
|
||||
@@ -539,7 +539,7 @@ static int get_device_firmware_node_sun(sd_device *dev, uint32_t *ret) {
|
||||
if (r < 0)
|
||||
return log_device_debug_errno(dev, r, "Failed to parse firmware_node/sun '%s', ignoring: %m", attr);
|
||||
if (sun == 0)
|
||||
return log_device_debug_errno(dev, SYNTHETIC_ERRNO(EINVAL), "firmware_node/sun == 0, ignoring: %m");
|
||||
return log_device_debug_errno(dev, SYNTHETIC_ERRNO(EINVAL), "firmware_node/sun == 0, ignoring.");
|
||||
|
||||
*ret = sun;
|
||||
return 0;
|
||||
|
||||
@@ -861,7 +861,7 @@ static int event_enter_locked(Event *event, const char *whole_disk) {
|
||||
if (isempty(whole_disk))
|
||||
return log_device_warning_errno(
|
||||
dev, SYNTHETIC_ERRNO(EBADMSG),
|
||||
"Unexpected notify message received, skipping event (SEQNUM=%"PRIu64", ACTION=%s): %m",
|
||||
"Unexpected notify message received, skipping event (SEQNUM=%"PRIu64", ACTION=%s).",
|
||||
event->seqnum, strna(device_action_to_string(event->action)));
|
||||
|
||||
_cleanup_free_ char *whole_disk_copy = strdup(whole_disk);
|
||||
|
||||
@@ -2204,7 +2204,7 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) {
|
||||
else if (S_ISBLK(st.st_mode))
|
||||
driver = "host_device";
|
||||
else
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Expected regular file or block device, not '%s': %m", *drive);
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Expected regular file or block device, not '%s'.", *drive);
|
||||
|
||||
r = strv_extendf(&cmdline, "driver=raw,cache.direct=off,cache.no-flush=on,file.driver=%s,file.filename=%s,node-name=vmspawn_extra_%zu", driver, escaped_drive, i);
|
||||
if (r < 0)
|
||||
|
||||
Reference in New Issue
Block a user