]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdopen.c
util: md_array_valid(): Introduce md_array_valid() helper
[thirdparty/mdadm.git] / mdopen.c
index 099efa0aa2e5cfaf5512054cd568a5005b393161..c4f1c12c2dcd8a9ce574ef3d77147826e96adbd3 100644 (file)
--- a/mdopen.c
+++ b/mdopen.c
@@ -442,7 +442,6 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
  */
 int open_mddev(char *dev, int report_errors)
 {
-       struct mdu_array_info_s array;
        int mdfd = open(dev, O_RDONLY);
 
        if (mdfd < 0) {
@@ -452,7 +451,7 @@ int open_mddev(char *dev, int report_errors)
                return -1;
        }
 
-       if (md_get_array_info(mdfd, &array) != 0) {
+       if (md_array_valid(mdfd) == 0) {
                close(mdfd);
                if (report_errors)
                        pr_err("%s does not appear to be an md device\n", dev);