[PATCH] add_feature: coredump

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "wei.huang" <huang.wei56@xxxxxxxxxx>

Problem:
when we configure device like vendor is COMPELNT in multipath.conf, multipathd will be coredump.

Reasons:
some vonders are not configured features in default_hw. In add_feature, strstr's first parameter *f maybe null.

Signed-off-by: wei.huang <huang.wei56@xxxxxxxxxx>
---
 libmultipath/structs.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index fee58e5..41e142f 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -520,6 +520,20 @@ add_feature (char **f, char *n)
 	if (!n || *n == '0')
 		return 0;
 
+	/* default feature is null */
+	if(!*f)
+	{
+		l = strlen("1 ") + strlen(n) + 1;
+		t = MALLOC(l);
+		if (!t)
+			return 1;
+
+		snprintf(t, l, "1 %s", n);
+		*f = t;
+	
+		return 0;
+	}
+
 	/* Check if feature is already present */
 	if (strstr(*f, n))
 		return 0;
-- 
2.8.1.windows.1

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux