switch-root would only mkdir the parents of the mount move directories.
With this patch, the mount move target directory is created to make
switch-root to an empty root directory work.
snprintf(new_mount, sizeof(new_mount), "%s%s", new_root, i);
char_array_0(new_mount);
snprintf(new_mount, sizeof(new_mount), "%s%s", new_root, i);
char_array_0(new_mount);
- mkdir_parents(new_mount, 0755);
+ mkdir_p(new_mount, 0755);
if ((stat(new_mount, &sb) < 0) ||
sb.st_dev != new_root_stat.st_dev) {
if ((stat(new_mount, &sb) < 0) ||
sb.st_dev != new_root_stat.st_dev) {