From 9c5f5683d087aafd03bebdeb71b7d8a116c3a250 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Tue, 16 Feb 2010 20:15:16 +0100 Subject: When use stat -c %D instead of stat -f -c %i for testing if /new_root is a mount point The old check couldn't distinguish different tmpfs mounts and failed to work with aufs (archiso). This check is actually the same one that busybox/switch_root uses to determine where to stop deleting files. If this check fails and we still launch switch_root it may start deleting data. --- init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init b/init index 3134530..3dbe916 100644 --- a/init +++ b/init @@ -110,7 +110,7 @@ mkdir -p /new_root ${mount_handler} /new_root [ -z "${init}" ] && init="/sbin/init" -if [ "$(stat -f -c %i /)" = "$(stat -f -c %i /new_root)" ]; then +if [ "$(stat -c %D /)" = "$(stat -c %D /new_root)" ]; then # Nothing got mounted on /new_root. This is the end, we don't know what to do anymore # We fall back into a shell, but the shell has now PID 1 # This way, manual recovery is still possible. -- cgit v1.2.3-24-g4f1b