Skip to content

Commit

Permalink
qcow2: Respect bdrv_truncate() error
Browse files Browse the repository at this point in the history
bdrv_truncate() may fail and qcow2_write_compressed() should return the
error code in that case.

Cc: [email protected]
Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Kevin Wolf <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
  • Loading branch information
XanClic authored and kevmw committed Dec 10, 2014
1 parent 3b5e14c commit 6a69b96
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions block/qcow2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2162,8 +2162,7 @@ static int qcow2_write_compressed(BlockDriverState *bs, int64_t sector_num,
/* align end of file to a sector boundary to ease reading with
sector based I/Os */
cluster_offset = bdrv_getlength(bs->file);
bdrv_truncate(bs->file, cluster_offset);
return 0;
return bdrv_truncate(bs->file, cluster_offset);
}

if (nb_sectors != s->cluster_sectors) {
Expand Down

0 comments on commit 6a69b96

Please sign in to comment.