bfs: erase ext2 superblock when initializing

Having valid superblocks from multiple filesystems on the same disk is
confusing, let's try to avoid that.

Change-Id: I1a58843d45ea52193a77faaf8dcc3ca6a049406e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1802
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Adrien Destugues
2019-08-30 19:18:20 +00:00
committed by waddlesplash
parent 354311b57b
commit e8f5d1ca66
@@ -828,8 +828,12 @@ Volume::_EraseUnusedBootBlock()
{
const int32 blockSize = 512;
const char emptySector[blockSize] = { 0 };
// Erase boot block if any
if (write_pos(fDevice, 0, emptySector, blockSize) != blockSize)
return B_IO_ERROR;
// Erase ext2 superblock if any
if (write_pos(fDevice, 1024, emptySector, blockSize) != blockSize)
return B_IO_ERROR;
return B_OK;
}