diff options
| author | gkostka <kostka.grzegorz@gmail.com> | 2015-11-15 22:57:32 +0100 |
|---|---|---|
| committer | gkostka <kostka.grzegorz@gmail.com> | 2015-11-15 22:57:32 +0100 |
| commit | 46513990026f467c02bc405fcf7607ecac410900 (patch) | |
| tree | 2ea27be4280f868b547c076bd0e0091a65d29545 /blockdev/linux | |
| parent | 16b7ebbb8f420dceb77baa18918ea5c7af0a156e (diff) | |
Return success when 0 block read/write is called
Diffstat (limited to 'blockdev/linux')
| -rw-r--r-- | blockdev/linux/ext4_filedev.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/blockdev/linux/ext4_filedev.c b/blockdev/linux/ext4_filedev.c index 7355c30..d017dd2 100644 --- a/blockdev/linux/ext4_filedev.c +++ b/blockdev/linux/ext4_filedev.c @@ -86,7 +86,8 @@ static int filedev_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id, { if (fseeko(dev_file, blk_id * bdev->ph_bsize, SEEK_SET)) return EIO; - + if (!blk_cnt) + return EOK; if (!fread(buf, bdev->ph_bsize * blk_cnt, 1, dev_file)) return EIO; @@ -112,7 +113,8 @@ static int filedev_bwrite(struct ext4_blockdev *bdev, const void *buf, { if (fseeko(dev_file, blk_id * bdev->ph_bsize, SEEK_SET)) return EIO; - + if (!blk_cnt) + return EOK; if (!fwrite(buf, bdev->ph_bsize * blk_cnt, 1, dev_file)) return EIO; |
