diff --git a/block/bochs.c b/block/bochs.c index bac81c42b7..f6a18f2bcb 100644 --- a/block/bochs.c +++ b/block/bochs.c @@ -199,7 +199,8 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num) // read in bitmap for current extent lseek(s->fd, bitmap_offset + (extent_offset / 8), SEEK_SET); - read(s->fd, &bitmap_entry, 1); + if (read(s->fd, &bitmap_entry, 1) != 1) + return -1; if (!((bitmap_entry >> (extent_offset % 8)) & 1)) {