Commit e6dffc42 authored by nextime's avatar nextime

Reverse debian patches

parent 5a2ecb6b
......@@ -888,7 +888,8 @@ fail:
static int pivot_into_new_root(void) {
int i, ret;
char *createdirs[] = {NEWROOT "/run/cgmanager", NEWROOT "/run/cgmanager/fs", NULL};
char *createdirs[] = {NEWROOT "/proc", NEWROOT "/run",
NEWROOT "/run/cgmanager", NEWROOT "/run/cgmanager/fs", NULL};
char path[100];
/* Mount tmpfs for new root */
......@@ -896,12 +897,20 @@ static int pivot_into_new_root(void) {
nih_fatal("%s: Failed to create directory for new root\n", __func__);
return -1;
}
ret = mount("/", NEWROOT, NULL, MS_BIND, 0);
ret = mount("root", NEWROOT, "tmpfs", 0, "size=10000,mode=0755");
if (ret < 0) {
nih_fatal("%s: Failed to bind-mount / for new root", __func__);
nih_fatal("%s: Failed to mount tmpfs for root", __func__);
return -1;
}
/* create /proc and /run/cgmanager/fs, and move-mount those */
for (i = 0; createdirs[i]; i++) {
if (mkdir(createdirs[i], 0755) < 0) {
nih_fatal("%s: failed to created %s\n", __func__, createdirs[i]);
return -1;
}
}
ret = snprintf(path, 100, NEWROOT "/proc");
if (ret < 0 || ret > 100)
return -1;
......@@ -910,25 +919,6 @@ static int pivot_into_new_root(void) {
__func__, strerror(errno));
return -1;
}
ret = snprintf(path, 100, NEWROOT "/run");
if (ret < 0 || ret > 100)
return -1;
ret = mount("/run", path, NULL, MS_BIND, 0);
if (ret < 0) {
nih_fatal("%s: failed to move /run into new root: %s",
__func__, strerror(errno));
return -1;
}
for (i = 0; createdirs[i]; i++) {
if (mkdir(createdirs[i], 0755) < 0 && errno != EEXIST) {
nih_fatal("%s: failed to create %s : %s\n", __func__,
createdirs[i], strerror(errno));
return -1;
}
}
ret = snprintf(path, 100, NEWROOT "/run/cgmanager/fs");
if (ret < 0 || ret > 100)
return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment