From 7aa5f85a748dcad3567c878b8623af446f0d8c4f Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Sat, 26 Sep 2009 21:26:06 -0700 Subject: [PATCH 1/3] fix umount --- switch_root.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-) diff --git a/switch_root.c b/switch_root.c index 8ce4aaf..1643a71 100644 --- a/switch_root.c +++ b/switch_root.c @@ -160,22 +160,15 @@ done: static int switchroot(const char *newroot) { /* Don't try to unmount the old "/", there's no way to do it. */ - const char *umounts[] = { "/dev", "/proc", "/sys", NULL }; + const char *umounts[] = { "/dev/pts", "/dev", "/proc", "/sys", NULL }; char *newroot_mnt; const char *chroot_path = NULL; int i; int r = -1; for (i = 0; umounts[i] != NULL; i++) { - char newmount[PATH_MAX]; - - snprintf(newmount, sizeof(newmount), "%s%s", newroot, umounts[i]); - - if (mount(umounts[i], newmount, NULL, MS_MOVE, NULL) < 0) { - warn("failed to mount moving %s to %s", - umounts[i], newmount); - warnx("forcing unmount of %s", umounts[i]); - umount2(umounts[i], MNT_FORCE); + if (umount2(umounts[i], MNT_FORCE) < 0) { + warn("failed to unmount %s", umounts[i]); } } -- 1.6.3.3