diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 953cd512a3..ecc502c273 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -1368,8 +1368,7 @@ int bus_unit_method_get_processes(sd_bus_message *message, void *userdata, sd_bu if (r < 0) return r; - CGroupRuntime *crt; - crt = unit_get_cgroup_runtime(u); + CGroupRuntime *crt = unit_get_cgroup_runtime(u); if (crt && crt->cgroup_path) { r = append_cgroup(reply, crt->cgroup_path, pids); if (r < 0) diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 5842d3ba8f..712fa65463 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -2251,23 +2251,22 @@ static int copy_devnodes(const char *dest) { } static int make_extra_nodes(const char *dest) { - size_t i; int r; BLOCK_WITH_UMASK(0000); - for (i = 0; i < arg_n_extra_nodes; i++) { + FOREACH_ARRAY(node, arg_extra_nodes, arg_n_extra_nodes) { _cleanup_free_ char *path = NULL; - DeviceNode *n = arg_extra_nodes + i; - path = path_join(dest, n->path); + path = path_join(dest, node->path); if (!path) return log_oom(); - if (mknod(path, n->mode, S_ISCHR(n->mode) || S_ISBLK(n->mode) ? makedev(n->major, n->minor) : 0) < 0) + dev_t dev = S_ISCHR(node->mode) || S_ISBLK(node->mode) ? makedev(node->major, node->minor) : 0; + if (mknod(path, node->mode, dev) < 0) return log_error_errno(errno, "Failed to create device node '%s': %m", path); - r = chmod_and_chown(path, n->mode, n->uid, n->gid); + r = chmod_and_chown(path, node->mode, node->uid, node->gid); if (r < 0) return log_error_errno(r, "Failed to adjust device node ownership of '%s': %m", path); } diff --git a/src/shared/btrfs-util.c b/src/shared/btrfs-util.c index f6055a8dba..e9a96cb3a2 100644 --- a/src/shared/btrfs-util.c +++ b/src/shared/btrfs-util.c @@ -1639,13 +1639,10 @@ int btrfs_qgroup_find_parents(int fd, uint64_t qgroupid, uint64_t **ret) { break; } - if (n_items <= 0) { - *ret = NULL; - return 0; - } + assert((n_items > 0) == !!items); + assert(n_items <= INT_MAX); *ret = TAKE_PTR(items); - return (int) n_items; }