Skip to contentSkip to conversation

fix raw_pread_aligned return value

PATCH New Christoph Hellwig 1 participant 1 message May 25, 2009 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

block/raw-posix.c +1 -1
Index: qemu/block/raw-posix.c
===================================================================
@@ -253,7 +253,7 @@ static int raw_pread_aligned(BlockDriver
 
 label__raw_read__success:
 
-    return ret;
+    return  (ret < 0) ? -errno : ret;
 }
 
 /*