From: Zbigniew Jędrzejewski-Szmek Date: Tue, 21 May 2024 16:10:12 +0000 (+0200) Subject: nspawn: use FOREACH_ARRAY() in one more place X-Git-Tag: v257-rc1~1191^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f43cbe66cf8eb89e0dac4e7cfb26f42275a1c96;p=thirdparty%2Fsystemd.git nspawn: use FOREACH_ARRAY() in one more place --- diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 5842d3ba8fa..712fa654632 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); }