dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/mdadm.c-fix-compile-error-switch-condition-has-boole.patch

2c1b57
From 13428e2e76e8149336282d514908ced424f878a2 Mon Sep 17 00:00:00 2001
2c1b57
From: Gioh Kim <gi-oh.kim@profitbricks.com>
2c1b57
Date: Thu, 30 Mar 2017 18:58:13 +0200
2c1b57
Subject: [RHEL7.5 PATCH 046/169] mdadm.c: fix compile error "switch
2c1b57
 condition has boolean value"
2c1b57
2c1b57
Remove a boolean expression in switch condition
2c1b57
to prevent compile error of some compilers,
2c1b57
for example, gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2).
2c1b57
2c1b57
Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com>
2c1b57
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
2c1b57
---
2c1b57
 mdadm.c | 14 ++++++--------
2c1b57
 1 file changed, 6 insertions(+), 8 deletions(-)
2c1b57
2c1b57
diff --git a/mdadm.c b/mdadm.c
2c1b57
index 0f32773..d6b5437 100644
2c1b57
--- a/mdadm.c
2c1b57
+++ b/mdadm.c
2c1b57
@@ -1965,14 +1965,12 @@ static int misc_list(struct mddev_dev *devlist,
2c1b57
 			rv |= SetAction(dv->devname, c->action);
2c1b57
 			continue;
2c1b57
 		}
2c1b57
-		switch(dv->devname[0] == '/') {
2c1b57
-			case 0:
2c1b57
-				mdfd = open_dev(dv->devname);
2c1b57
-				if (mdfd >= 0)
2c1b57
-					break;
2c1b57
-			case 1:
2c1b57
-				mdfd = open_mddev(dv->devname, 1);  
2c1b57
-		}
2c1b57
+
2c1b57
+		if (dv->devname[0] != '/')
2c1b57
+			mdfd = open_dev(dv->devname);
2c1b57
+		if (dv->devname[0] == '/' || mdfd < 0)
2c1b57
+			mdfd = open_mddev(dv->devname, 1);
2c1b57
+
2c1b57
 		if (mdfd >= 0) {
2c1b57
 			switch(dv->disposition) {
2c1b57
 			case 'R':
2c1b57
-- 
2c1b57
2.7.4
2c1b57