Blame SOURCES/mdassemble-Use-md_get_array_info-to-check-for-valid-.patch
|
|
2c1b57 |
From 1c9591115d577841522acd245cd2445cb77ee204 Mon Sep 17 00:00:00 2001
|
|
|
2c1b57 |
From: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
|
2c1b57 |
Date: Wed, 5 Apr 2017 15:46:35 -0400
|
|
|
2c1b57 |
Subject: [RHEL7.5 PATCH 064/169] mdassemble: Use md_get_array_info() to
|
|
|
2c1b57 |
check for valid array
|
|
|
2c1b57 |
|
|
|
2c1b57 |
Get rid of another use of md_get_version()
|
|
|
2c1b57 |
|
|
|
2c1b57 |
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
|
|
|
2c1b57 |
---
|
|
|
2c1b57 |
mdassemble.c | 9 ++++-----
|
|
|
2c1b57 |
1 file changed, 4 insertions(+), 5 deletions(-)
|
|
|
2c1b57 |
|
|
|
2c1b57 |
diff --git a/mdassemble.c b/mdassemble.c
|
|
|
2c1b57 |
index a24b324..f0833bc 100644
|
|
|
2c1b57 |
--- a/mdassemble.c
|
|
|
2c1b57 |
+++ b/mdassemble.c
|
|
|
2c1b57 |
@@ -32,13 +32,12 @@ char const Name[] = "mdassemble";
|
|
|
2c1b57 |
/* from mdopen.c */
|
|
|
2c1b57 |
int open_mddev(char *dev, int report_errors/*unused*/)
|
|
|
2c1b57 |
{
|
|
|
2c1b57 |
+ struct mdu_array_info_s array;
|
|
|
2c1b57 |
int mdfd = open(dev, O_RDONLY);
|
|
|
2c1b57 |
if (mdfd < 0)
|
|
|
2c1b57 |
- pr_err("error opening %s: %s\n",
|
|
|
2c1b57 |
- dev, strerror(errno));
|
|
|
2c1b57 |
- else if (md_get_version(mdfd) <= 0) {
|
|
|
2c1b57 |
- pr_err("%s does not appear to be an md device\n",
|
|
|
2c1b57 |
- dev);
|
|
|
2c1b57 |
+ pr_err("error opening %s: %s\n", dev, strerror(errno));
|
|
|
2c1b57 |
+ else if (md_get_array_info(mdfd, &array) != 0) {
|
|
|
2c1b57 |
+ pr_err("%s does not appear to be an md device\n", dev);
|
|
|
2c1b57 |
close(mdfd);
|
|
|
2c1b57 |
mdfd = -1;
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
--
|
|
|
2c1b57 |
2.7.4
|
|
|
2c1b57 |
|