X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Fswitch-root.c;h=b12189cd10c7a195f98de5e0eaea9d4599f119fe;hp=ca3875628aa2be32d6b9a8a4e906cdf66a05893b;hb=ebbac6d948b9d323b3d57bfd7c3513776e591dc1;hpb=4a62c710b62a5a3c7a8a278b810b9d5b5a0c8f4f diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c index ca3875628..b12189cd1 100644 --- a/src/shared/switch-root.c +++ b/src/shared/switch-root.c @@ -29,10 +29,11 @@ #include "util.h" #include "path-util.h" -#include "switch-root.h" #include "mkdir.h" +#include "rm-rf.h" #include "base-filesystem.h" #include "missing.h" +#include "switch-root.h" int switch_root(const char *new_root, const char *oldroot, bool detach_oldroot, unsigned long mountflags) { @@ -51,7 +52,7 @@ int switch_root(const char *new_root, const char *oldroot, bool detach_oldroot, if (path_equal(new_root, "/")) return 0; - temporary_old_root = strappenda(new_root, oldroot); + temporary_old_root = strjoina(new_root, oldroot); mkdir_p_label(temporary_old_root, 0755); old_root_remove = in_initrd(); @@ -72,7 +73,6 @@ int switch_root(const char *new_root, const char *oldroot, bool detach_oldroot, struct stat sb; snprintf(new_mount, sizeof(new_mount), "%s%s", new_root, i); - char_array_0(new_mount); mkdir_p_label(new_mount, 0755); @@ -105,7 +105,7 @@ int switch_root(const char *new_root, const char *oldroot, bool detach_oldroot, * to look like. They might even boot, if they are RO and * don't have the FS layout. Just ignore the error and * switch_root() nevertheless. */ - (void) base_filesystem_create(new_root); + (void) base_filesystem_create(new_root, UID_INVALID, GID_INVALID); if (chdir(new_root) < 0) return log_error_errno(errno, "Failed to change directory to %s: %m", new_root); @@ -143,7 +143,7 @@ int switch_root(const char *new_root, const char *oldroot, bool detach_oldroot, if (fstat(old_root_fd, &rb) < 0) log_warning_errno(errno, "Failed to stat old root directory, leaving: %m"); else { - rm_rf_children(old_root_fd, false, false, &rb); + (void) rm_rf_children(old_root_fd, 0, &rb); old_root_fd = -1; } }