]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - util.c
util/must_be_container: Use sysfs_read(GET_VERSION) to determine valid array
[thirdparty/mdadm.git] / util.c
diff --git a/util.c b/util.c
index 9fc7ba03c2349fbf18371df6887e84d5d980ecec..56daee34c5b76c3195d52beb9064be200040492a 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1376,9 +1376,14 @@ int get_dev_sector_size(int fd, char *dname, unsigned int *sectsizep)
  */
 int must_be_container(int fd)
 {
+       struct mdinfo *mdi;
        unsigned long long size;
-       if (md_get_version(fd) < 0)
+
+       mdi = sysfs_read(fd, NULL, GET_VERSION);
+       if (!mdi)
                return 0;
+       sysfs_free(mdi);
+
        if (get_dev_size(fd, NULL, &size) == 0)
                return 1;
        if (size == 0)