diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-15 20:44:26 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-15 20:44:26 +0000 |
commit | 5b6829561200dde69d368fd8d9910544f627bc2b (patch) | |
tree | 14906324fdbf45367260573a01e61190cb0f5106 /block-raw-posix.c | |
parent | 08de7238832f16b19f5dd7c734af0e589937fa58 (diff) | |
download | qemu-5b6829561200dde69d368fd8d9910544f627bc2b.tar.gz qemu-5b6829561200dde69d368fd8d9910544f627bc2b.tar.bz2 qemu-5b6829561200dde69d368fd8d9910544f627bc2b.zip |
Return -errno on write failure (Gleb Natapov)
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6324 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block-raw-posix.c')
-rw-r--r-- | block-raw-posix.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/block-raw-posix.c b/block-raw-posix.c index 2fbb714d01..d17af0b34e 100644 --- a/block-raw-posix.c +++ b/block-raw-posix.c @@ -252,7 +252,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); @@ -262,7 +262,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; @@ -277,7 +277,7 @@ static int raw_pwrite_aligned(BlockDriverState *bs, int64_t offset, label__raw_write__success: - return ret; + return (ret < 0) ? -errno : ret; } |