forked from pool/mdadm
43 lines
1.3 KiB
Diff
43 lines
1.3 KiB
Diff
|
From 1c9591115d577841522acd245cd2445cb77ee204 Mon Sep 17 00:00:00 2001
|
||
|
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||
|
Date: Wed, 5 Apr 2017 15:46:35 -0400
|
||
|
Subject: [PATCH] mdassemble: Use md_get_array_info() to check for valid array
|
||
|
Git-commit: 1c9591115d577841522acd245cd2445cb77ee204
|
||
|
Patch-mainline: mdadm-4.0+
|
||
|
References: bsc#1069165, bsc#1069167, bsc#1068030
|
||
|
|
||
|
Get rid of another use of md_get_version()
|
||
|
|
||
|
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
||
|
Signed-off-by: Coly Li <colyli@suse.de>
|
||
|
|
||
|
---
|
||
|
mdassemble.c | 9 ++++-----
|
||
|
1 file changed, 4 insertions(+), 5 deletions(-)
|
||
|
|
||
|
diff --git a/mdassemble.c b/mdassemble.c
|
||
|
index a24b324..f0833bc 100644
|
||
|
--- a/mdassemble.c
|
||
|
+++ b/mdassemble.c
|
||
|
@@ -32,13 +32,12 @@ char const Name[] = "mdassemble";
|
||
|
/* from mdopen.c */
|
||
|
int open_mddev(char *dev, int report_errors/*unused*/)
|
||
|
{
|
||
|
+ struct mdu_array_info_s array;
|
||
|
int mdfd = open(dev, O_RDONLY);
|
||
|
if (mdfd < 0)
|
||
|
- pr_err("error opening %s: %s\n",
|
||
|
- dev, strerror(errno));
|
||
|
- else if (md_get_version(mdfd) <= 0) {
|
||
|
- pr_err("%s does not appear to be an md device\n",
|
||
|
- dev);
|
||
|
+ pr_err("error opening %s: %s\n", dev, strerror(errno));
|
||
|
+ else if (md_get_array_info(mdfd, &array) != 0) {
|
||
|
+ pr_err("%s does not appear to be an md device\n", dev);
|
||
|
close(mdfd);
|
||
|
mdfd = -1;
|
||
|
}
|
||
|
--
|
||
|
2.13.6
|
||
|
|