aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block-raw-posix.c13
-rw-r--r--block-raw-win32.c4
2 files changed, 15 insertions, 2 deletions
diff --git a/block-raw-posix.c b/block-raw-posix.c
index 696128b80b..1a1a1781bc 100644
--- a/block-raw-posix.c
+++ b/block-raw-posix.c
@@ -361,7 +361,12 @@ static int raw_pread(BlockDriverState *bs, int64_t offset,
static int raw_read(BlockDriverState *bs, int64_t sector_num,
uint8_t *buf, int nb_sectors)
{
- return raw_pread(bs, sector_num * 512, buf, (uint64_t)nb_sectors * 512);
+ int ret;
+
+ ret = raw_pread(bs, sector_num * 512, buf, nb_sectors * 512);
+ if (ret == (nb_sectors * 512))
+ ret = 0;
+ return ret;
}
/*
@@ -445,7 +450,11 @@ static int raw_pwrite(BlockDriverState *bs, int64_t offset,
static int raw_write(BlockDriverState *bs, int64_t sector_num,
const uint8_t *buf, int nb_sectors)
{
- return raw_pwrite(bs, sector_num * 512, buf, (uint64_t)nb_sectors * 512);
+ int ret;
+ ret = raw_pwrite(bs, sector_num * 512, buf, nb_sectors * 512);
+ if (ret == (nb_sectors * 512))
+ ret = 0;
+ return ret;
}
#ifdef CONFIG_AIO
diff --git a/block-raw-win32.c b/block-raw-win32.c
index 8564a72762..d034b4a069 100644
--- a/block-raw-win32.c
+++ b/block-raw-win32.c
@@ -145,6 +145,8 @@ static int raw_read(BlockDriverState *bs, int64_t sector_num,
#endif
return ret_count;
}
+ if (ret_count == count)
+ ret_count = 0;
return ret_count;
}
@@ -171,6 +173,8 @@ static int raw_write(BlockDriverState *bs, int64_t sector_num,
#endif
return ret_count;
}
+ if (ret_count == count)
+ ret_count = 0;
return ret_count;
}