summaryrefslogtreecommitdiffstats
path: root/bitmap.c
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@redhat.com>2016-08-15 22:21:33 +0200
committerJes Sorensen <Jes.Sorensen@redhat.com>2016-08-15 22:21:33 +0200
commit34996a5f89c6808f77ec552b7c920013b46bf13d (patch)
tree79bf6e664187aff44ccd5eaf1fa265e704a87738 /bitmap.c
parentbitmap: Simplify code for bitmap_file_open() (diff)
downloadmdadm-34996a5f89c6808f77ec552b7c920013b46bf13d.tar.xz
mdadm-34996a5f89c6808f77ec552b7c920013b46bf13d.zip
bitmap: Handle errors when reading bitmap info for cluster nodes
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Diffstat (limited to 'bitmap.c')
-rw-r--r--bitmap.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/bitmap.c b/bitmap.c
index 29c36a65..e9dee738 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -350,7 +350,17 @@ int ExamineBitmap(char *filename, int brief, struct supertype *st)
st = NULL;
free(info);
fd = bitmap_file_open(filename, &st, i);
+ if (fd < 0) {
+ printf(" Unable to open bitmap file on node: %i\n", i);
+
+ continue;
+ }
info = bitmap_fd_read(fd, brief);
+ if (!info) {
+ close(fd);
+ printf(" Unable to read bitmap on node: %i\n", i);
+ continue;
+ }
sb = &info->sb;
if (sb->magic != BITMAP_MAGIC)
pr_err("invalid bitmap magic 0x%x, the bitmap file appears to be corrupted\n", sb->magic);