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

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