Fix detection of magic superblock

This commit is contained in:
Vincent Ollivier 2020-07-12 09:56:49 +02:00
parent 672b89fd49
commit c91d7a95cf
1 changed files with 5 additions and 3 deletions

View File

@ -686,9 +686,11 @@ pub fn init() {
for dsk in 0..2 {
let mut buf = [0u8; 512];
kernel::ata::read(bus, dsk, SUPERBLOCK_ADDR, &mut buf);
if String::from_utf8(buf[0..8].to_vec()).unwrap() == MAGIC {
log!("MFS Superblock found in ATA {}:{}\n", bus, dsk);
mount(bus, dsk);
if let Ok(header) = String::from_utf8(buf[0..8].to_vec()) {
if header == MAGIC {
log!("MFS Superblock found in ATA {}:{}\n", bus, dsk);
mount(bus, dsk);
}
}
}
}