Received: from eggs.gnu.org ([2001:4830:134:3::10]:51157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvrKK-0003Sc-EY for qemu-devel@nongnu.org; Tue, 02 Dec 2014 12:33:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XvrKE-0006cV-CE for qemu-devel@nongnu.org; Tue, 02 Dec 2014 12:33:28 -0500 From: Max Reitz Date: Tue, 2 Dec 2014 18:32:52 +0100 Message-Id: <1417541573-15823-13-git-send-email-mreitz@redhat.com> In-Reply-To: <1417541573-15823-1-git-send-email-mreitz@redhat.com> References: <1417541573-15823-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v3 12/13] qcow2: Respect bdrv_truncate() error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Lieven , qemu-stable@nongnu.org, Markus Armbruster , Stefan Hajnoczi , Max Reitz bdrv_truncate() may fail and qcow2_write_compressed() should return the error code in that case. Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- block/qcow2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 2a867f5..e4e690a 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -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) { -- 1.9.3