1
0
mirror of https://github.com/systemd/systemd synced 2024-07-09 04:26:06 +00:00

Merge pull request #32972 from keszybz/small-cleanups

Small cleanups
This commit is contained in:
Yu Watanabe 2024-06-12 18:38:09 +09:00 committed by GitHub
commit 42d281a197
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 13 deletions

View File

@ -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)

View File

@ -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);
}

View File

@ -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;
}