]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
fix raw_pread_aligned return value
authorChristoph Hellwig <hch@lst.de>
Mon, 25 May 2009 08:08:52 +0000 (10:08 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 27 May 2009 14:47:30 +0000 (09:47 -0500)
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>
block-raw-posix.c

index 85ca70494676ccedf287e16956483df41937c150..af3d468750ee4f940d5fd628ac7e88a03beeb46c 100644 (file)
@@ -234,7 +234,7 @@ static int raw_pread_aligned(BlockDriverState *bs, int64_t offset,
 
 label__raw_read__success:
 
-    return ret;
+    return  (ret < 0) ? -errno : ret;
 }
 
 /*