No functional change intended.
int mntid;
r = path_get_mnt_id_at_fallback(dir_fd, "", &mntid);
- if (r < 0) {
- if (ERRNO_IS_NOT_SUPPORTED(r))
- return true; /* skip the mount ID check */
+ if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
+ return true; /* skip the mount ID check */
+ if (r < 0)
return r;
- }
assert(mntid >= 0);
st.nsx.stx_mnt_id = mntid;
int mntid;
r = path_get_mnt_id_at_fallback(dir_fd, "..", &mntid);
- if (r < 0) {
- if (ERRNO_IS_NOT_SUPPORTED(r))
- return true; /* skip the mount ID check */
+ if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
+ return true; /* skip the mount ID check */
+ if (r < 0)
return r;
- }
assert(mntid >= 0);
pst.nsx.stx_mnt_id = mntid;
/* No xattr or cannot parse it? Then skip this. */
_cleanup_free_ char *extension_release_xattr = NULL;
r = fgetxattr_malloc(extension_release_fd, "user.extension-release.strict", &extension_release_xattr);
- if (r < 0) {
- if (!ERRNO_IS_XATTR_ABSENT(r))
- return log_debug_errno(r,
- "%s/%s: Failed to read 'user.extension-release.strict' extended attribute from file, ignoring: %m",
- extension_release_dir_path, filename);
-
- return log_debug_errno(r, "%s/%s does not have user.extension-release.strict xattr, ignoring.", extension_release_dir_path, filename);
- }
+ if (ERRNO_IS_NEG_XATTR_ABSENT(r))
+ return log_debug_errno(r, "%s/%s does not have user.extension-release.strict xattr, ignoring.",
+ extension_release_dir_path, filename);
+ if (r < 0)
+ return log_debug_errno(r, "%s/%s: Failed to read 'user.extension-release.strict' extended attribute from file, ignoring: %m",
+ extension_release_dir_path, filename);
/* Explicitly set to request strict matching? Skip it. */
r = parse_boolean(extension_release_xattr);
FOREACH_STRING(p, "/proc/pressure/cpu", "/proc/pressure/io", "/proc/pressure/memory") {
r = read_virtual_file(p, 0, NULL, NULL);
- if (r < 0) {
- if (r == -ENOENT || ERRNO_IS_NOT_SUPPORTED(r))
- return (cached = false);
-
+ if (r == -ENOENT || ERRNO_IS_NEG_NOT_SUPPORTED(r))
+ return (cached = false);
+ if (r < 0)
return r;
- }
}
return (cached = true);
_cleanup_strv_free_ char **efi_entries = NULL;
r = efi_loader_get_entries(&efi_entries);
- if (r < 0) {
- if (r == -ENOENT || ERRNO_IS_NOT_SUPPORTED(r))
- log_debug_errno(r, "Boot loader reported no entries.");
- else
- log_warning_errno(r, "Failed to determine entries reported by boot loader, ignoring: %m");
- } else
+ if (r == -ENOENT || ERRNO_IS_NEG_NOT_SUPPORTED(r))
+ log_debug_errno(r, "Boot loader reported no entries.");
+ else if (r < 0)
+ log_warning_errno(r, "Failed to determine entries reported by boot loader, ignoring: %m");
+ else
(void) boot_config_augment_from_loader(config, efi_entries, /* only_auto= */ false);
}
r = bus_unit_queue_job_one(message, u,
JOB_TRY_RESTART, JOB_FAIL, flags,
reply, error);
+ if (ERRNO_IS_NEG_RESOURCE(r))
+ return r;
if (r < 0) {
- if (ERRNO_IS_RESOURCE(r))
- return r;
if (ret >= 0)
ret = r;
sd_bus_error_free(error);
}
if (context->oom_score_adjust_set) {
- /* When we can't make this change due to EPERM, then let's silently skip over it. User namespaces
- * prohibit write access to this file, and we shouldn't trip up over that. */
+ /* When we can't make this change due to EPERM, then let's silently skip over it. User
+ * namespaces prohibit write access to this file, and we shouldn't trip up over that. */
r = set_oom_score_adjust(context->oom_score_adjust);
- if (r < 0) {
- if (ERRNO_IS_PRIVILEGE(r))
- log_unit_debug_errno(unit, r, "Failed to adjust OOM setting, assuming containerized execution, ignoring: %m");
- else {
- *exit_status = EXIT_OOM_ADJUST;
- return log_unit_error_errno(unit, r, "Failed to adjust OOM setting: %m");
- }
+ if (ERRNO_IS_NEG_PRIVILEGE(r))
+ log_unit_debug_errno(unit, r,
+ "Failed to adjust OOM setting, assuming containerized execution, ignoring: %m");
+ else if (r < 0) {
+ *exit_status = EXIT_OOM_ADJUST;
+ return log_unit_error_errno(unit, r, "Failed to adjust OOM setting: %m");
}
}
if (context->coredump_filter_set) {
r = set_coredump_filter(context->coredump_filter);
- if (r < 0) {
- if (ERRNO_IS_PRIVILEGE(r))
- log_unit_debug_errno(unit, r, "Failed to adjust coredump_filter, ignoring: %m");
- else
- return log_unit_error_errno(unit, r, "Failed to adjust coredump_filter: %m");
- }
+ if (ERRNO_IS_NEG_PRIVILEGE(r))
+ log_unit_debug_errno(unit, r, "Failed to adjust coredump_filter, ignoring: %m");
+ else if (r < 0)
+ return log_unit_error_errno(unit, r, "Failed to adjust coredump_filter: %m");
}
if (context->nice_set) {
if (mpol_is_valid(numa_policy_get_type(&context->numa_policy))) {
r = apply_numa_policy(&context->numa_policy);
- if (r < 0) {
- if (ERRNO_IS_NOT_SUPPORTED(r))
- log_unit_debug_errno(unit, r, "NUMA support not available, ignoring.");
- else {
- *exit_status = EXIT_NUMA_POLICY;
- return log_unit_error_errno(unit, r, "Failed to set NUMA memory policy: %m");
- }
+ if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
+ log_unit_debug_errno(unit, r, "NUMA support not available, ignoring.");
+ else if (r < 0) {
+ *exit_status = EXIT_NUMA_POLICY;
+ return log_unit_error_errno(unit, r, "Failed to set NUMA memory policy: %m");
}
}
* namespace without the ability to set up "lo". Hence gracefully skip things then. */
if (ns_type_supported(NAMESPACE_NET) && have_effective_cap(CAP_NET_ADMIN) > 0) {
r = setup_shareable_ns(runtime->shared->netns_storage_socket, CLONE_NEWNET);
- if (r < 0) {
- if (ERRNO_IS_PRIVILEGE(r))
- log_unit_notice_errno(unit, r,
- "PrivateNetwork=yes is configured, but network namespace setup not permitted, proceeding without: %m");
- else {
- *exit_status = EXIT_NETWORK;
- return log_unit_error_errno(unit, r, "Failed to set up network namespacing: %m");
- }
+ if (ERRNO_IS_NEG_PRIVILEGE(r))
+ log_unit_notice_errno(unit, r,
+ "PrivateNetwork=yes is configured, but network namespace setup not permitted, proceeding without: %m");
+ else if (r < 0) {
+ *exit_status = EXIT_NETWORK;
+ return log_unit_error_errno(unit, r, "Failed to set up network namespacing: %m");
}
} else if (context->network_namespace_path) {
*exit_status = EXIT_NETWORK;
}
r = check_password_quality(new_password, /* old */ NULL, /* user */ NULL, &error);
- if (r < 0) {
- if (ERRNO_IS_NOT_SUPPORTED(r))
- log_warning("Password quality check is not supported, proceeding anyway.");
- else
- return log_error_errno(r, "Failed to check password quality: %m");
- }
- if (r == 0)
+ if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
+ log_warning("Password quality check is not supported, proceeding anyway.");
+ else if (r < 0)
+ return log_error_errno(r, "Failed to check password quality: %m");
+ else if (r == 0)
log_warning("Specified password does not pass quality checks (%s), proceeding anyway.", error);
keyslot = crypt_keyslot_add_by_volume_key(
found_some
? "No TPM2 metadata matching the current system state found in LUKS2 header, falling back to traditional unlocking."
: "No TPM2 metadata enrolled in LUKS2 header, falling back to traditional unlocking.");
- if (r < 0) {
- if (ERRNO_IS_NOT_SUPPORTED(r)) /* TPM2 support not compiled in? */
- return log_debug_errno(SYNTHETIC_ERRNO(EAGAIN), "TPM2 support not available, falling back to traditional unlocking.");
+ if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
+ /* TPM2 support not compiled in? */
+ return log_debug_errno(SYNTHETIC_ERRNO(EAGAIN),
+ "TPM2 support not available, falling back to traditional unlocking.");
+ if (r < 0)
return r;
- }
found_some = true;
}
r = check_password_quality(*a, /* old */ NULL, "root", &error);
- if (r < 0) {
- if (ERRNO_IS_NOT_SUPPORTED(r))
- log_warning("Password quality check is not supported, proceeding anyway.");
- else
- return log_error_errno(r, "Failed to check password quality: %m");
- }
- if (r == 0)
+ if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
+ log_warning("Password quality check is not supported, proceeding anyway.");
+ else if (r < 0)
+ return log_error_errno(r, "Failed to check password quality: %m");
+ else if (r == 0)
log_warning("Password is weak, accepting anyway: %s", error);
r = ask_password_tty(-1, msg2, NULL, 0, 0, NULL, &b);
return r;
r = home_update_quota_auto(h, NULL);
- if (r < 0) {
- if (ERRNO_IS_NOT_SUPPORTED(r))
- return -ESOCKTNOSUPPORT; /* make recognizable */
+ if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
+ return -ESOCKTNOSUPPORT; /* make recognizable */
+ if (r < 0)
return r;
- }
r = home_store_embedded_identity(new_home, setup->root_fd, h->uid, embedded_home);
if (r < 0)
return r;
r = sym_crypt_init_by_name(&cd, setup->dm_name);
- if (r < 0) {
- if ((ERRNO_IS_DEVICE_ABSENT(r) || r == -EINVAL) && graceful)
- return 0;
+ if ((ERRNO_IS_NEG_DEVICE_ABSENT(r) || r == -EINVAL) && graceful)
+ return 0;
+ if (r < 0)
return log_error_errno(r, "Failed to initialize cryptsetup context for %s: %m", setup->dm_name);
- }
cryptsetup_enable_logging(cd);
cryptsetup_enable_logging(setup->crypt_device);
r = sym_crypt_deactivate_by_name(setup->crypt_device, setup->dm_name, 0);
- if (r < 0) {
- if (ERRNO_IS_DEVICE_ABSENT(r) || r == -EINVAL)
- log_debug_errno(r, "LUKS device %s is already detached.", setup->dm_node);
- else
- return log_info_errno(r, "LUKS device %s couldn't be deactivated: %m", setup->dm_node);
- } else {
+ if (ERRNO_IS_NEG_DEVICE_ABSENT(r) || r == -EINVAL)
+ log_debug_errno(r, "LUKS device %s is already detached.", setup->dm_node);
+ else if (r < 0)
+ return log_info_errno(r, "LUKS device %s couldn't be deactivated: %m", setup->dm_node);
+ else {
log_info("LUKS device detaching completed.");
we_detached = true;
}
return log_error_errno(SYNTHETIC_ERRNO(ETIMEDOUT), "Device link %s still hasn't shown up, giving up.", path);
r = fd_wait_for_event(inotify_fd, POLLIN, until - w);
- if (r < 0) {
- if (ERRNO_IS_TRANSIENT(r))
- continue;
+ if (ERRNO_IS_NEG_TRANSIENT(r))
+ continue;
+ if (r < 0)
return log_error_errno(r, "Failed to watch inotify: %m");
- }
(void) flush_fd(inotify_fd);
}
return log_error_errno(SYNTHETIC_ERRNO(ENODEV), "File system %s not backed by a block device.", path);
r = quotactl_devnum(QCMD_FIXED(Q_GETQUOTA, USRQUOTA), devno, h->uid, &req);
- if (r < 0) {
- if (ERRNO_IS_NOT_SUPPORTED(r))
- return log_error_errno(r, "No UID quota support on %s.", path);
-
- if (r != -ESRCH)
- return log_error_errno(r, "Failed to query disk quota for UID " UID_FMT ": %m", h->uid);
-
+ if (r == -ESRCH)
zero(req);
- } else {
+ else if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
+ return log_error_errno(r, "No UID quota support on %s.", path);
+ else if (r < 0)
+ return log_error_errno(r, "Failed to query disk quota for UID " UID_FMT ": %m", h->uid);
+ else if (FLAGS_SET(req.dqb_valid, QIF_BLIMITS) && h->disk_size / QIF_DQBLKSIZE == req.dqb_bhardlimit) {
/* Shortcut things if everything is set up properly already */
- if (FLAGS_SET(req.dqb_valid, QIF_BLIMITS) && h->disk_size / QIF_DQBLKSIZE == req.dqb_bhardlimit) {
- log_info("Configured quota already matches the intended setting, not updating quota.");
- return 0;
- }
+ log_info("Configured quota already matches the intended setting, not updating quota.");
+ return 0;
}
req.dqb_valid = QIF_BLIMITS;
req.dqb_bsoftlimit = req.dqb_bhardlimit = h->disk_size / QIF_DQBLKSIZE;
r = quotactl_devnum(QCMD_FIXED(Q_SETQUOTA, USRQUOTA), devno, h->uid, &req);
- if (r < 0) {
- if (r == -ESRCH)
- return log_error_errno(SYNTHETIC_ERRNO(ENOTTY), "UID quota not available on %s.", path);
-
+ if (r == -ESRCH)
+ return log_error_errno(SYNTHETIC_ERRNO(ENOTTY), "UID quota not available on %s.", path);
+ if (r < 0)
return log_error_errno(r, "Failed to set disk quota for UID " UID_FMT ": %m", h->uid);
- }
log_info("Updated per-UID quota.");
return log_debug_errno(r, "Failed to get the unit's cgroup path for %s: %m", cgroup);
r = cg_get_xattr_malloc(SYSTEMD_CGROUP_CONTROLLER, unit_cgroup, "user.journald_log_filter_patterns", &xattr);
- if (r < 0) {
- if (!ERRNO_IS_XATTR_ABSENT(r))
- return log_debug_errno(r, "Failed to get user.journald_log_filter_patterns xattr for %s: %m", unit_cgroup);
-
+ if (ERRNO_IS_NEG_XATTR_ABSENT(r)) {
client_set_filtering_patterns(c, NULL, NULL);
return 0;
- }
+ } else if (r < 0)
+ return log_debug_errno(r, "Failed to get user.journald_log_filter_patterns xattr for %s: %m", unit_cgroup);
xattr_end = xattr + r;
* before writing to xattr. */
deny_list_xattr = memchr(xattr, (char)0xff, r);
if (!deny_list_xattr)
- return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG), "Missing delimiter in cgroup user.journald_log_filter_patterns attribute: %m");
+ return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG),
+ "Missing delimiter in cgroup user.journald_log_filter_patterns attribute: %m");
r = client_parse_log_filter_nulstr(xattr, deny_list_xattr - xattr, &allow_list);
if (r < 0)
assert(link);
r = link_get_wiphy(link, &w);
- if (r < 0) {
- if (ERRNO_IS_NOT_SUPPORTED(r) || ERRNO_IS_DEVICE_ABSENT(r))
- return false; /* Typically, non-wifi interface or running in container */
+ if (ERRNO_IS_NEG_NOT_SUPPORTED(r) || ERRNO_IS_NEG_DEVICE_ABSENT(r))
+ return false; /* Typically, non-wifi interface or running in container */
+ if (r < 0)
return log_link_debug_errno(link, r, "Could not get phy: %m");
- }
return wiphy_rfkilled(w);
}
assert(w);
r = wiphy_update_device(w);
- if (r < 0) {
- if (ERRNO_IS_DEVICE_ABSENT(r))
- log_wiphy_debug_errno(w, r, "Failed to update wiphy device, ignoring: %m");
- else
- return log_wiphy_warning_errno(w, r, "Failed to update wiphy device: %m");
- }
+ if (ERRNO_IS_NEG_DEVICE_ABSENT(r))
+ log_wiphy_debug_errno(w, r, "Failed to update wiphy device, ignoring: %m");
+ else if (r < 0)
+ return log_wiphy_warning_errno(w, r, "Failed to update wiphy device: %m");
r = wiphy_update_rfkill(w);
- if (r < 0) {
- if (ERRNO_IS_DEVICE_ABSENT(r))
- log_wiphy_debug_errno(w, r, "Failed to update rfkill device, ignoring: %m");
- else
- return log_wiphy_warning_errno(w, r, "Failed to update rfkill device: %m");
- }
+ if (ERRNO_IS_NEG_DEVICE_ABSENT(r))
+ log_wiphy_debug_errno(w, r, "Failed to update rfkill device, ignoring: %m");
+ else if (r < 0)
+ return log_wiphy_warning_errno(w, r, "Failed to update rfkill device: %m");
return 0;
}
* container behaves nicely). */
r = id128_get_machine(directory, &arg_uuid);
- if (r < 0) {
- if (!ERRNO_IS_MACHINE_ID_UNSET(r)) /* If the file is missing, empty, or uninitialized, we don't mind */
- return log_error_errno(r, "Failed to read machine ID from container image: %m");
-
+ if (ERRNO_IS_NEG_MACHINE_ID_UNSET(r)) {
+ /* If the file is missing, empty, or uninitialized, we don't mind */
if (sd_id128_is_null(arg_uuid)) {
r = sd_id128_randomize(&arg_uuid);
if (r < 0)
return log_error_errno(r, "Failed to acquire randomized machine UUID: %m");
}
- }
+ } else if (r < 0)
+ return log_error_errno(r, "Failed to read machine ID from container image: %m");
return 0;
}
arg_uid_shift != 0) {
r = remount_idmap(directory, arg_uid_shift, arg_uid_range, UID_INVALID, REMOUNT_IDMAPPING_HOST_ROOT);
- if (r < 0) {
- if (r == -EINVAL || ERRNO_IS_NOT_SUPPORTED(r)) {
- /* This might fail because the kernel or file system doesn't support idmapping. We
- * can't really distinguish this nicely, nor do we have any guarantees about the
- * error codes we see, could be EOPNOTSUPP or EINVAL. */
- if (arg_userns_ownership != USER_NAMESPACE_OWNERSHIP_AUTO)
- return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
- "ID mapped mounts are apparently not available, sorry.");
-
- log_debug("ID mapped mounts are apparently not available on this kernel or for the selected file system, reverting to recursive chown()ing.");
- arg_userns_ownership = USER_NAMESPACE_OWNERSHIP_CHOWN;
- } else
- return log_error_errno(r, "Failed to set up ID mapped mounts: %m");
- } else {
+ if (r == -EINVAL || ERRNO_IS_NEG_NOT_SUPPORTED(r)) {
+ /* This might fail because the kernel or file system doesn't support idmapping. We
+ * can't really distinguish this nicely, nor do we have any guarantees about the
+ * error codes we see, could be EOPNOTSUPP or EINVAL. */
+ if (arg_userns_ownership != USER_NAMESPACE_OWNERSHIP_AUTO)
+ return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
+ "ID mapped mounts are apparently not available, sorry.");
+
+ log_debug("ID mapped mounts are apparently not available on this kernel or for the selected file system, reverting to recursive chown()ing.");
+ arg_userns_ownership = USER_NAMESPACE_OWNERSHIP_CHOWN;
+ } else if (r < 0)
+ return log_error_errno(r, "Failed to set up ID mapped mounts: %m");
+ else {
log_debug("ID mapped mounts available, making use of them.");
idmap = true;
}
}
n = recvmsg_safe(fd, &msghdr, MSG_DONTWAIT|MSG_CMSG_CLOEXEC);
- if (n < 0) {
- if (ERRNO_IS_TRANSIENT(n))
- return 0;
- if (n == -EXFULL) {
- log_warning("Got message with truncated control data (too many fds sent?), ignoring.");
- return 0;
- }
+ if (ERRNO_IS_NEG_TRANSIENT(n))
+ return 0;
+ else if (n == -EXFULL) {
+ log_warning("Got message with truncated control data (too many fds sent?), ignoring.");
+ return 0;
+ } else if (n < 0)
return log_warning_errno(n, "Couldn't read notification socket: %m");
- }
cmsg_close_all(&msghdr);
return log_error_errno(errno, "Failed to allocate udev control socket: %m");
r = connect_unix_path(fd, AT_FDCWD, "/run/udev/control");
- if (r < 0) {
- if (r == -ENOENT || ERRNO_IS_DISCONNECT(r))
- return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
- "Sorry, but --image= requires access to the host's /run/ hierarchy, since we need access to udev.");
-
+ if (r == -ENOENT || ERRNO_IS_NEG_DISCONNECT(r))
+ return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
+ "Sorry, but --image= requires access to the host's /run/ hierarchy, since we need access to udev.");
+ if (r < 0)
return log_error_errno(r, "Failed to connect socket to udev control socket: %m");
- }
r = getpeercred(fd, &ucred);
if (r < 0)
iov = IOVEC_MAKE(DNS_PACKET_DATA(p), p->allocated);
l = recvmsg_safe(fd, &mh, 0);
- if (l < 0) {
- if (ERRNO_IS_TRANSIENT(l))
- return 0;
- return l;
- }
- if (l == 0)
+ if (ERRNO_IS_NEG_TRANSIENT(l))
return 0;
+ if (l <= 0)
+ return l;
assert(!(mh.msg_flags & MSG_TRUNC));
return -errno;
r = fd_wait_for_event(fd, POLLOUT, LESS_BY(end, now(CLOCK_MONOTONIC)));
- if (r < 0) {
- if (ERRNO_IS_TRANSIENT(r))
- continue;
+ if (ERRNO_IS_NEG_TRANSIENT(r))
+ continue;
+ if (r < 0)
return r;
- }
if (r == 0)
return -ETIMEDOUT;
}
return -errno;
r = fd_wait_for_event(fd, POLLOUT, LESS_BY(end, now(CLOCK_MONOTONIC)));
- if (r < 0) {
- if (ERRNO_IS_TRANSIENT(r))
- continue;
+ if (ERRNO_IS_NEG_TRANSIENT(r))
+ continue;
+ if (r < 0)
return r;
- }
if (r == 0)
return -ETIMEDOUT;
}
return -EUNATCH;
r = lookup_key(keyname, &serial);
- if (r < 0) {
- /* when retrieving the distinction between "kernel or container manager don't support
- * or allow this" and "no matching key known" doesn't matter. Note that we propagate
- * EACCESS here (even if EPERM not) since that is used if the keyring is available but
- * we lack access to the key. */
- if (ERRNO_IS_NOT_SUPPORTED(r) || r == -EPERM)
- return -ENOKEY;
-
+ if (ERRNO_IS_NEG_NOT_SUPPORTED(r) || r == -EPERM)
+ /* When retrieving, the distinction between "kernel or container manager don't support or
+ * allow this" and "no matching key known" doesn't matter. Note that we propagate EACCESS
+ * here (even if EPERM not) since that is used if the keyring is available, but we lack
+ * access to the key. */
+ return -ENOKEY;
+ if (r < 0)
return r;
- }
return retrieve_key(serial, ret);
}
};
n = recvmsg_safe(socket_fd, &msghdr, 0);
- if (n < 0) {
- if (ERRNO_IS_TRANSIENT(n))
- continue;
- if (n == -EXFULL) {
- log_debug("Got message with truncated control data, ignoring.");
- continue;
- }
-
+ if (ERRNO_IS_NEG_TRANSIENT(n))
+ continue;
+ else if (n == -EXFULL) {
+ log_debug("Got message with truncated control data, ignoring.");
+ continue;
+ } else if (n < 0) {
r = (int) n;
goto finish;
}
r = RET_NERRNO(mkfifoat(dt, to, st->st_mode & 07777));
if (copy_flags & COPY_MAC_CREATE)
mac_selinux_create_file_clear();
- if (r < 0) {
- if (FLAGS_SET(copy_flags, COPY_GRACEFUL_WARN) && (ERRNO_IS_PRIVILEGE(r) || ERRNO_IS_NOT_SUPPORTED(r))) {
- log_notice_errno(r, "Failed to copy fifo '%s', ignoring: %m", from);
- return 0;
- }
-
+ if (FLAGS_SET(copy_flags, COPY_GRACEFUL_WARN) && (ERRNO_IS_NEG_PRIVILEGE(r) || ERRNO_IS_NEG_NOT_SUPPORTED(r))) {
+ log_notice_errno(r, "Failed to copy fifo '%s', ignoring: %m", from);
+ return 0;
+ } else if (r < 0)
return r;
- }
if (fchownat(dt, to,
uid_is_valid(override_uid) ? override_uid : st->st_uid,
r = RET_NERRNO(mknodat(dt, to, st->st_mode, st->st_rdev));
if (copy_flags & COPY_MAC_CREATE)
mac_selinux_create_file_clear();
- if (r < 0) {
- if (FLAGS_SET(copy_flags, COPY_GRACEFUL_WARN) && (ERRNO_IS_PRIVILEGE(r) || ERRNO_IS_NOT_SUPPORTED(r))) {
- log_notice_errno(r, "Failed to copy node '%s', ignoring: %m", from);
- return 0;
- }
-
+ if (FLAGS_SET(copy_flags, COPY_GRACEFUL_WARN) && (ERRNO_IS_NEG_PRIVILEGE(r) || ERRNO_IS_NEG_NOT_SUPPORTED(r))) {
+ log_notice_errno(r, "Failed to copy node '%s', ignoring: %m", from);
+ return 0;
+ } else if (r < 0)
return r;
- }
if (fchownat(dt, to,
uid_is_valid(override_uid) ? override_uid : st->st_uid,
&(struct recurse_dir_userdata) {
.keymaps = keymaps,
});
- if (r < 0) {
- if (r == -ENOENT)
- continue;
- if (ERRNO_IS_RESOURCE(r))
- return log_warning_errno(r, "Failed to read keymap list from %s: %m", dir);
-
+ if (r == -ENOENT)
+ continue;
+ if (ERRNO_IS_NEG_RESOURCE(r))
+ return log_warning_errno(r, "Failed to read keymap list from %s: %m", dir);
+ if (r < 0)
log_debug_errno(r, "Failed to read keymap list from %s, ignoring: %m", dir);
- }
}
_cleanup_strv_free_ char **l = set_get_strv(keymaps);
}
r = json_parse_file(NULL, j, JSON_PARSE_SENSITIVE, &privileged_v, NULL, NULL);
- if (r < 0) {
- if (ERRNO_IS_PRIVILEGE(r))
- have_privileged = false;
- else if (r == -ENOENT)
- have_privileged = true; /* if the privileged file doesn't exist, we are complete */
- else
- return r;
- } else {
+ if (ERRNO_IS_NEG_PRIVILEGE(r))
+ have_privileged = false;
+ else if (r == -ENOENT)
+ have_privileged = true; /* if the privileged file doesn't exist, we are complete */
+ else if (r < 0)
+ return r;
+ else {
r = json_variant_merge(&v, privileged_v);
if (r < 0)
return r;
}
r = json_parse_file(NULL, j, JSON_PARSE_SENSITIVE, &privileged_v, NULL, NULL);
- if (r < 0) {
- if (ERRNO_IS_PRIVILEGE(r))
- have_privileged = false;
- else if (r == -ENOENT)
- have_privileged = true; /* if the privileged file doesn't exist, we are complete */
- else
- return r;
- } else {
+ if (ERRNO_IS_NEG_PRIVILEGE(r))
+ have_privileged = false;
+ else if (r == -ENOENT)
+ have_privileged = true; /* if the privileged file doesn't exist, we are complete */
+ else if (r < 0)
+ return r;
+ else {
r = json_variant_merge(&v, privileged_v);
if (r < 0)
return r;
return -ETIME;
k = fd_wait_for_event(fd, POLLOUT, end - t);
- if (k < 0) {
- if (ERRNO_IS_TRANSIENT(k))
- continue;
+ if (ERRNO_IS_NEG_TRANSIENT(k))
+ continue;
+ if (k < 0)
return k;
- }
if (k == 0)
return -ETIME;
}
r = fd_wait_for_event(v->fd, POLLOUT, USEC_INFINITY);
- if (r < 0) {
- if (ERRNO_IS_TRANSIENT(r))
- continue;
-
+ if (ERRNO_IS_NEG_TRANSIENT(r))
+ continue;
+ if (r < 0)
return varlink_log_errno(v, r, "Poll failed on fd: %m");
- }
-
- assert(r != 0);
+ assert(r > 0);
handle_revents(v, r);
}
continue;
r = sd_bus_process(b, &m);
- if (r < 0) {
- /* treat 'connection reset by peer' as clean exit condition */
- if (ERRNO_IS_DISCONNECT(r))
- return 0;
-
+ if (ERRNO_IS_NEG_DISCONNECT(r))
+ /* Treat 'connection reset by peer' as clean exit condition */
+ return 0;
+ if (r < 0)
return log_error_errno(r, "Failed to process bus: %m");
- }
if (m) {
r = sd_bus_send(a, m, NULL);
};
r = ppoll_usec(p, ELEMENTSOF(p), t);
- if (r < 0) {
- if (ERRNO_IS_TRANSIENT(r)) /* don't be bothered by signals, i.e. EINTR */
- continue;
+ if (r < 0 && !ERRNO_IS_TRANSIENT(r)) /* don't be bothered by signals, i.e. EINTR */
return log_error_errno(r, "ppoll() failed: %m");
- }
}
return 0;