Commit 4141d4c2517b685484e323aeddd1051be3bc7294

Authored by aliguori
1 parent 42fb2807

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
Showing 1 changed file with 3 additions and 3 deletions
block-raw-posix.c
... ... @@ -252,7 +252,7 @@ static int raw_pwrite_aligned(BlockDriverState *bs, int64_t offset,
252 252  
253 253 ret = fd_open(bs);
254 254 if (ret < 0)
255   - return ret;
  255 + return -errno;
256 256  
257 257 if (offset >= 0 && lseek(s->fd, offset, SEEK_SET) == (off_t)-1) {
258 258 ++(s->lseek_err_cnt);
... ... @@ -262,7 +262,7 @@ static int raw_pwrite_aligned(BlockDriverState *bs, int64_t offset,
262 262 s->fd, bs->filename, offset, buf, count,
263 263 bs->total_sectors, errno, strerror(errno));
264 264 }
265   - return -1;
  265 + return -EIO;
266 266 }
267 267 s->lseek_err_cnt = 0;
268 268  
... ... @@ -277,7 +277,7 @@ static int raw_pwrite_aligned(BlockDriverState *bs, int64_t offset,
277 277  
278 278 label__raw_write__success:
279 279  
280   - return ret;
  280 + return (ret < 0) ? -errno : ret;
281 281 }
282 282  
283 283  
... ...