summaryrefslogtreecommitdiff
blob: 1914b2310f2b34b5aae4d07ab4dc660302eb7866 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From 7aa5f85a748dcad3567c878b8623af446f0d8c4f Mon Sep 17 00:00:00 2001
From: Lance Albertson <lance@osuosl.org>
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