Commit 94c6d6d815c0295b101b45a101007fcf22c5171a

Authored by Christoph Hellwig
Committed by Anthony Liguori
1 parent afd32160

fix raw_pread_aligned return value

raw_pread_aligned currently returns the raw return value from
lseek/read, which is always -1 in case of an error.  But the
callers higher up the stack expect it to return the negated
errno just like raw_pwrite_aligned.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing 1 changed file with 1 additions and 1 deletions
block/raw-posix.c
@@ -249,7 +249,7 @@ static int raw_pread_aligned(BlockDriverState *bs, int64_t offset, @@ -249,7 +249,7 @@ static int raw_pread_aligned(BlockDriverState *bs, int64_t offset,
249 249
250 label__raw_read__success: 250 label__raw_read__success:
251 251
252 - return ret; 252 + return (ret < 0) ? -errno : ret;
253 } 253 }
254 254
255 /* 255 /*