Merge pull request #40 from steadfasterX/hotfix/partsize

fix wrong part_size calculation (1 sector missing)
This commit is contained in:
Peter Wu 2018-01-10 21:10:14 +01:00 committed by GitHub
commit cef3647a87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -26,7 +26,7 @@ def dump_partitions(comm, disk_fd, outdir, max_size):
diskinfo = partitions.get_partitions(comm, disk_fd)
for part in diskinfo.gpt.partitions:
part_offset = part.first_lba * partitions.BLOCK_SIZE
part_size = (part.last_lba - part.first_lba) * partitions.BLOCK_SIZE
part_size = (part.last_lba - (part.first_lba - 1)) * partitions.BLOCK_SIZE
part_name = part.name
part_label = "/dev/mmcblk0p%i" % part.index
if max_size and part_size > max_size:

View file

@ -259,7 +259,7 @@ def main():
_logger.debug("%s", info)
part_offset = part.first_lba * BLOCK_SIZE
part_size = (part.last_lba - part.first_lba) * BLOCK_SIZE
part_size = (part.last_lba - (part.first_lba - 1)) * BLOCK_SIZE
_logger.debug("Opened fd %d for disk", disk_fd)
if args.dump: