mirror of
https://git.busybox.net/busybox.git
synced 2024-11-24 06:03:27 +08:00
switch_root: more clear error messages
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
4e60f304d4
commit
cb37637b47
@ -85,12 +85,14 @@ int switch_root_main(int argc UNUSED_PARAM, char **argv)
|
||||
// Additional sanity checks: we're about to rm -rf /, so be REALLY SURE
|
||||
// we mean it. I could make this a CONFIG option, but I would get email
|
||||
// from all the people who WILL destroy their filesystems.
|
||||
if (stat("/init", &st) != 0 || !S_ISREG(st.st_mode)) {
|
||||
bb_error_msg_and_die("/init is not a regular file");
|
||||
}
|
||||
statfs("/", &stfs); // this never fails
|
||||
if (stat("/init", &st) != 0 || !S_ISREG(st.st_mode)
|
||||
|| ((unsigned)stfs.f_type != RAMFS_MAGIC
|
||||
&& (unsigned)stfs.f_type != TMPFS_MAGIC)
|
||||
if ((unsigned)stfs.f_type != RAMFS_MAGIC
|
||||
&& (unsigned)stfs.f_type != TMPFS_MAGIC
|
||||
) {
|
||||
bb_error_msg_and_die("not rootfs");
|
||||
bb_error_msg_and_die("root filesystem is not ramfs/tmpfs");
|
||||
}
|
||||
|
||||
// Zap everything out of rootdev
|
||||
|
Loading…
Reference in New Issue
Block a user