aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/raw-posix.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 96f26173ef..7ce72e9e4e 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -391,8 +391,12 @@ static int raw_pread(BlockDriverState *bs, int64_t offset,
size = ALIGNED_BUFFER_SIZE;
ret = raw_pread_aligned(bs, offset, s->aligned_buf, size);
- if (ret < 0)
+ if (ret < 0) {
return ret;
+ } else if (ret == 0) {
+ fprintf(stderr, "raw_pread: read beyond end of file\n");
+ abort();
+ }
size = ret;
if (size > count)