summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/nspawn/nspawn.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 8fd307b1d8..0cb26cbc31 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2148,30 +2148,32 @@ static int setup_boot_id(void) {
}
static int copy_devnodes(const char *dest) {
- static const char devnodes[] =
- "null\0"
- "zero\0"
- "full\0"
- "random\0"
- "urandom\0"
- "tty\0"
- "net/tun\0";
-
+ _cleanup_strv_free_ char **devnodes = NULL;
int r = 0;
assert(dest);
+ devnodes = strv_new("null",
+ "zero",
+ "full",
+ "random",
+ "urandom",
+ "tty",
+ "net/tun");
+ if (!devnodes)
+ return log_oom();
+
BLOCK_WITH_UMASK(0000);
/* Create /dev/net, so that we can create /dev/net/tun in it */
if (userns_mkdir(dest, "/dev/net", 0755, 0, 0) < 0)
return log_error_errno(r, "Failed to create /dev/net directory: %m");
- NULSTR_FOREACH(d, devnodes) {
+ STRV_FOREACH(d, devnodes) {
_cleanup_free_ char *from = NULL, *to = NULL;
struct stat st;
- from = path_join("/dev/", d);
+ from = path_join("/dev/", *d);
if (!from)
return log_oom();
@@ -2225,7 +2227,7 @@ static int copy_devnodes(const char *dest) {
if (!prefixed)
return log_oom();
- t = path_join("..", d);
+ t = path_join("..", *d);
if (!t)
return log_oom();