From 3b687800d6180af51acc1ea3062baafdae4e843c Mon Sep 17 00:00:00 2001 From: FactorialN Date: Sun, 29 Oct 2023 16:04:32 -0700 Subject: [PATCH] fixed numsec issue --- include/rawdisk.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/rawdisk.h b/include/rawdisk.h index d0a25ae..62074df 100644 --- a/include/rawdisk.h +++ b/include/rawdisk.h @@ -29,14 +29,14 @@ public: } // Use ioctl with BLKGETSIZE to get the number of sectors - if (ioctl(fd, BLKGETSIZE64, &numSectors) == -1) { + if (ioctl(fd, BLKGETSIZE64, &diskSize) == -1) { perror("Error getting disk size"); close(fd); exit(1); } // Calculate the size in bytes - diskSize = numSectors * 512; // Assuming a sector size of 512 bytes + numSectors = diskSize / 512; // Assuming a sector size of 512 bytes printf("====Initializing RawDisk====\n"); printf("Number of sectors: %llu\n", numSectors);