]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
bitmap: Handle errors when reading bitmap info for cluster nodes
authorJes Sorensen <Jes.Sorensen@redhat.com>
Mon, 15 Aug 2016 20:21:33 +0000 (16:21 -0400)
committerJes Sorensen <Jes.Sorensen@redhat.com>
Mon, 15 Aug 2016 20:21:33 +0000 (16:21 -0400)
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
bitmap.c

index 29c36a6508038289d1efc8aaa82bf3a570de04a9..e9dee738632dac71b1d5e36a6007208f26224c4c 100644 (file)
--- 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);