From 8ca76cb7413141f8a45489c574dc94331324b086 Mon Sep 17 00:00:00 2001 From: aliguori <aliguori> Date: Thu, 15 Jan 2009 20:44:26 +0000 Subject: [PATCH 37/54] Return -errno on write failure (Gleb Natapov) Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> RH-Upstream-status: applied(qemu), pending(maint/2.6.29) --- qemu/block-raw-posix.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/qemu/block-raw-posix.c b/qemu/block-raw-posix.c index 820de24..6a2b517 100644 --- a/qemu/block-raw-posix.c +++ b/qemu/block-raw-posix.c @@ -253,7 +253,7 @@ static int raw_pwrite_aligned(BlockDriverState *bs, int64_t offset, ret = fd_open(bs); if (ret < 0) - return ret; + return -errno; if (offset >= 0 && lseek(s->fd, offset, SEEK_SET) == (off_t)-1) { ++(s->lseek_err_cnt); @@ -263,7 +263,7 @@ static int raw_pwrite_aligned(BlockDriverState *bs, int64_t offset, s->fd, bs->filename, offset, buf, count, bs->total_sectors, errno, strerror(errno)); } - return -1; + return -EIO; } s->lseek_err_cnt = 0; @@ -278,7 +278,7 @@ static int raw_pwrite_aligned(BlockDriverState *bs, int64_t offset, label__raw_write__success: - return ret; + return (ret < 0) ? -errno : ret; } -- 1.6.1