diff options
Diffstat (limited to 'tooling')
| -rw-r--r-- | tooling/fsck.hefs.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tooling/fsck.hefs.cc b/tooling/fsck.hefs.cc index ce386152..0fa697be 100644 --- a/tooling/fsck.hefs.cc +++ b/tooling/fsck.hefs.cc @@ -18,7 +18,7 @@ int main(int argc, char** argv) { auto args = mkfs::detail::build_args(argc, argv); - auto opt_disk = mkfs::get_option<char>(args, "-i"); + auto opt_disk = mkfs::get_option<char>(args, "-i"); if (opt_disk.empty()) { mkfs::console_out() << "fsck: hefs: error: HeFS is empty! Exiting..." @@ -26,7 +26,6 @@ int main(int argc, char** argv) { return EXIT_FAILURE; } - std::ifstream output_device(opt_disk, std::ios::binary); if (!output_device.good()) { @@ -37,6 +36,11 @@ int main(int argc, char** argv) { mkfs::hefs::BootNode boot_node; std::memset(&boot_node, 0, sizeof(boot_node)); + if (strncmp(boot_node.magic, kHeFSMagic, kHeFSMagicLen) != 0) { + mkfs::console_out() << "hefs: error: Device is not an HeFS disk: " << opt_disk << "\n"; + return EXIT_FAILURE; + } + mkfs::console_out() << "hefs: HeFS partition is is healthy, exiting...\r"; return EXIT_SUCCESS; |
