Skip to content

Commit

Permalink
virtnbdmap: read data at valid block position
Browse files Browse the repository at this point in the history
  • Loading branch information
abbbi committed Feb 7, 2025
1 parent efffeba commit ee223ec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions virtnbd-nbdkit-plugin
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ def pread(h, buf, offset, _):
to_read = remaining

if next_block["data"]:
log(f"Read {to_read} data size from this block.")
fileOffset = next_block["offset"] - next_block["originalOffset"] + offset
data += os.pread(h, to_read, fileOffset)
fileOffset = next_block["offset"]
log(f"Read {to_read} data size at {next_block['offset']} from this block.")
data += os.pread(h, to_read, next_block["offset"])
else:
log(f"Next block contains zeroes, return {remaining} zeroes")
data += b"\0" * to_read
Expand Down

0 comments on commit ee223ec

Please sign in to comment.