mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-11-04 04:06:42 +00:00
atahd: Make sure disk is not too big.
This commit is contained in:
parent
eaddcab0ba
commit
96dc02b249
@ -63,11 +63,15 @@ int AtaHardDisk::device_postinit() {
|
||||
|
||||
void AtaHardDisk::insert_image(std::string filename) {
|
||||
if (!this->hdd_img.open(filename)) {
|
||||
ABORT_F("%s: could not open image file", this->name.c_str());
|
||||
ABORT_F("%s: could not open image file \"%s\"", this->name.c_str(), filename.c_str());
|
||||
}
|
||||
|
||||
this->img_size = this->hdd_img.size();
|
||||
this->total_sectors = this->hdd_img.size() / ATA_HD_SEC_SIZE;
|
||||
uint64_t sectors = this->hdd_img.size() / ATA_HD_SEC_SIZE;
|
||||
this->total_sectors = (uint32_t)sectors;
|
||||
if (sectors != this->total_sectors) {
|
||||
ABORT_F("%s: image file \"%s\" is too big", this->name.c_str(), filename.c_str());
|
||||
}
|
||||
this->calc_chs_params();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user