diff options
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn-cgroup.c | 6 | ||||
-rw-r--r-- | src/nspawn/nspawn-mount.c | 16 | ||||
-rw-r--r-- | src/nspawn/nspawn.c | 8 |
3 files changed, 18 insertions, 12 deletions
diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c index f84bb39796..0462b46413 100644 --- a/src/nspawn/nspawn-cgroup.c +++ b/src/nspawn/nspawn-cgroup.c @@ -370,7 +370,7 @@ static int mount_legacy_cgns_supported( if (streq(controller, tok)) break; - target = prefix_root("/sys/fs/cgroup/", tok); + target = path_join("/sys/fs/cgroup/", tok); if (!target) return log_oom(); @@ -451,7 +451,7 @@ static int mount_legacy_cgns_unsupported( if (!controller) break; - origin = prefix_root("/sys/fs/cgroup/", controller); + origin = path_join("/sys/fs/cgroup/", controller); if (!origin) return log_oom(); @@ -468,7 +468,7 @@ static int mount_legacy_cgns_unsupported( else { _cleanup_free_ char *target = NULL; - target = prefix_root(dest, origin); + target = path_join(dest, origin); if (!target) return log_oom(); diff --git a/src/nspawn/nspawn-mount.c b/src/nspawn/nspawn-mount.c index 5a1bce4abc..e0740a6cc4 100644 --- a/src/nspawn/nspawn-mount.c +++ b/src/nspawn/nspawn-mount.c @@ -97,7 +97,7 @@ static char *resolve_source_path(const char *dest, const char *source) { return NULL; if (source[0] == '+') - return prefix_root(dest, source + 1); + return path_join(dest, source + 1); return strdup(source); } @@ -433,11 +433,11 @@ int mount_sysfs(const char *dest, MountSettingsMask mount_settings) { FOREACH_STRING(x, "block", "bus", "class", "dev", "devices", "kernel") { _cleanup_free_ char *from = NULL, *to = NULL; - from = prefix_root(full, x); + from = path_join(full, x); if (!from) return log_oom(); - to = prefix_root(top, x); + to = path_join(top, x); if (!to) return log_oom(); @@ -1190,7 +1190,9 @@ int setup_pivot_root(const char *directory, const char *pivot_root_new, const ch * Requires all file systems at directory and below to be mounted * MS_PRIVATE or MS_SLAVE so they can be moved. */ - directory_pivot_root_new = prefix_root(directory, pivot_root_new); + directory_pivot_root_new = path_join(directory, pivot_root_new); + if (!directory_pivot_root_new) + return log_oom(); /* Remount directory_pivot_root_new to make it movable. */ r = mount_verbose(LOG_ERR, directory_pivot_root_new, directory_pivot_root_new, NULL, MS_BIND, NULL); @@ -1204,7 +1206,11 @@ int setup_pivot_root(const char *directory, const char *pivot_root_new, const ch } remove_pivot_tmp = true; - pivot_tmp_pivot_root_old = prefix_root(pivot_tmp, pivot_root_old); + pivot_tmp_pivot_root_old = path_join(pivot_tmp, pivot_root_old); + if (!pivot_tmp_pivot_root_old) { + r = log_oom(); + goto done; + } r = mount_verbose(LOG_ERR, directory_pivot_root_new, pivot_tmp, NULL, MS_MOVE, NULL); if (r < 0) diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 1c0187ae5c..e7f8cf389f 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -1895,11 +1895,11 @@ static int copy_devnodes(const char *dest) { _cleanup_free_ char *from = NULL, *to = NULL; struct stat st; - from = strappend("/dev/", d); + from = path_join("/dev/", d); if (!from) return log_oom(); - to = prefix_root(dest, from); + to = path_join(dest, from); if (!to) return log_oom(); @@ -1945,7 +1945,7 @@ static int copy_devnodes(const char *dest) { if (asprintf(&sl, "%s/%u:%u", dn, major(st.st_rdev), minor(st.st_rdev)) < 0) return log_oom(); - prefixed = prefix_root(dest, sl); + prefixed = path_join(dest, sl); if (!prefixed) return log_oom(); @@ -1972,7 +1972,7 @@ static int make_extra_nodes(const char *dest) { _cleanup_free_ char *path = NULL; DeviceNode *n = arg_extra_nodes + i; - path = prefix_root(dest, n->path); + path = path_join(dest, n->path); if (!path) return log_oom(); |