From 94c6d6d815c0295b101b45a101007fcf22c5171a Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Mon, 25 May 2009 10:08:52 +0200 Subject: [PATCH] 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 Signed-off-by: Anthony Liguori --- block/raw-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index 86e3067762..57da1df649 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -249,7 +249,7 @@ static int raw_pread_aligned(BlockDriverState *bs, int64_t offset, label__raw_read__success: - return ret; + return (ret < 0) ? -errno : ret; } /* -- 2.34.1