Blame SOURCES/fcoe-utils-v1.0.32-1-fcoe-utils-Fix-get_ctlr_num-for-large-ctlr_-indices.patch

30fd80
From f369a89e914eb1f14b26d6e84fa32fdf8a591cfc Mon Sep 17 00:00:00 2001
30fd80
From: Andrey Grafin <Andrey.Grafin@acronis.com>
30fd80
Date: Mon, 18 Sep 2017 17:35:08 +0300
30fd80
Subject: [PATCH 1/1] fcoe-utils: Fix get_ctlr_num() for large ctlr_* indices
30fd80
30fd80
Each creation of a FCoE device increases counter which is used as a suffix
30fd80
in a FCoE device name in sysfs (i.e. /sys/bus/fcoe/devices/ctlr_1).
30fd80
Once this counter reaches the value of two digits (10 and larger),
30fd80
get_ctlr_num() stopped working properly and a command like `fcoeadm -i`
30fd80
which depends on get_ctlr_num() call doesn't show anything.
30fd80
This patch solves this problem.
30fd80
30fd80
Signed-off-by: Andrey Grafin <Andrey.Grafin@acronis.com>
30fd80
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
30fd80
---
30fd80
 lib/sysfs_hba.c | 2 +-
30fd80
 1 file changed, 1 insertion(+), 1 deletion(-)
30fd80
30fd80
diff --git a/lib/sysfs_hba.c b/lib/sysfs_hba.c
30fd80
index 5cb7fd3fa5d5..786215440bac 100644
30fd80
--- a/lib/sysfs_hba.c
30fd80
+++ b/lib/sysfs_hba.c
30fd80
@@ -606,7 +606,7 @@ static int get_ctlr_num(const char *netdev)
30fd80
 		if (!ctlr)
30fd80
 			continue;
30fd80
 
30fd80
-		ctlr_num = atoi(&ctlr[strlen(ctlr) - 1]);
30fd80
+		ctlr_num = atoi(&ctlr[sizeof("ctlr_") - 1]);
30fd80
 		break;
30fd80
 	}
30fd80
 
30fd80
-- 
30fd80
2.14.4
30fd80