[Debian-ha-commits] [ocfs2-tools] 51/58: o2image: return error if pread64 failed in ocfs2_image_load_bitmap()
Valentin Vidic
vvidic-guest at moszumanska.debian.org
Tue Jun 20 13:40:44 UTC 2017
This is an automated email from the git hooks/post-receive script.
vvidic-guest pushed a commit to branch upstream
in repository ocfs2-tools.
commit bbad5577c6a2a9b8adcbb4862e83d2a36ad8a623
Author: piaojun <piaojun at huawei.com>
Date: Thu Dec 29 11:30:56 2016 +0800
o2image: return error if pread64 failed in ocfs2_image_load_bitmap()
In ocfs2_image_load_bitmap(), if pread64 failed, we need catch the
errno and return errno to upper callers. otherwise we may get the
incorrect 'arr_map' but 'o2image -I' execute successfully.
Signed-off-by: Jun Piao <piaojun at huawei.com>
Reviewed-by: Joseph Qi <jiangqi903 at gmail.com>
---
libocfs2/image.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libocfs2/image.c b/libocfs2/image.c
index fe95530..4d4cce2 100644
--- a/libocfs2/image.c
+++ b/libocfs2/image.c
@@ -163,7 +163,8 @@ errcode_t ocfs2_image_load_bitmap(ocfs2_filesys *ofs)
struct ocfs2_image_state *ost;
struct ocfs2_image_hdr *hdr;
uint64_t blk_off, bits_set;
- int count, i, j, fd;
+ int i, j, fd;
+ ssize_t count;
errcode_t ret;
char *blk;
@@ -218,8 +219,10 @@ errcode_t ocfs2_image_load_bitmap(ocfs2_filesys *ofs)
*/
count = pread64(fd, ost->ost_bmparr[i].arr_map,
ost->ost_bmpblksz, blk_off);
- if (count < ost->ost_bmpblksz)
+ if (count < 0) {
+ ret = OCFS2_ET_IO;
goto out;
+ }
/* add bits set in this bitmap */
for (j = 0; j < (ost->ost_bmpblksz * 8); j++)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-ha/ocfs2-tools.git
More information about the Debian-HA-Commits
mailing list