summaryrefslogtreecommitdiffstats
path: root/mdadm.c
diff options
context:
space:
mode:
authorGioh Kim <gi-oh.kim@profitbricks.com>2017-03-30 18:58:13 +0200
committerJes Sorensen <Jes.Sorensen@gmail.com>2017-03-30 13:46:14 -0400
commit13428e2e76e8149336282d514908ced424f878a2 (patch)
treeeacb20f4cb647550f7e9e9709b5e5f4b40c5a067 /mdadm.c
parentb53bfba6119d3f6f56eb9e10e5a59da6901af159 (diff)
downloadmdadm-13428e2e76e8149336282d514908ced424f878a2.tar.gz
mdadm.c: fix compile error "switch condition has boolean value"
Remove a boolean expression in switch condition to prevent compile error of some compilers, for example, gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2). Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Diffstat (limited to 'mdadm.c')
-rw-r--r--mdadm.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/mdadm.c b/mdadm.c
index 0f327738..d6b54378 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1965,14 +1965,12 @@ static int misc_list(struct mddev_dev *devlist,
rv |= SetAction(dv->devname, c->action);
continue;
}
- switch(dv->devname[0] == '/') {
- case 0:
- mdfd = open_dev(dv->devname);
- if (mdfd >= 0)
- break;
- case 1:
- mdfd = open_mddev(dv->devname, 1);
- }
+
+ if (dv->devname[0] != '/')
+ mdfd = open_dev(dv->devname);
+ if (dv->devname[0] == '/' || mdfd < 0)
+ mdfd = open_mddev(dv->devname, 1);
+
if (mdfd >= 0) {
switch(dv->disposition) {
case 'R':