代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/sysfsutils 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 744befa9faa3446ff6bf0627cadb6a3addae1dd1 Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Fri, 3 Jul 2020 11:14:20 -0700
Subject: [PATCH 1/9] Fix issue with sysfs name comparisons.
It turns out that cdev_name_equal() is used
by dlist_find_custom() to compare sysfs
entry names to ones already seen. But it was
comparing using the length of the shortest string
as a maximum, so when it compared, for example,
"eth1" and "eth10", it thought they were the same.
So now just return failure if the strings
aren't the same length, else go ahead and
compare them.
Signed-off-by: Lee Duncan <lduncan@suse.com>
---
lib/sysfs_class.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/lib/sysfs_class.c b/lib/sysfs_class.c
index 4fe0b82..c696ff0 100644
--- a/lib/sysfs_class.c
+++ b/lib/sysfs_class.c
@@ -60,13 +60,30 @@ void sysfs_close_class(struct sysfs_class *cls)
}
}
+/*
+ * pass this function to dlist_find_custom()
+ * so it can compare device names
+ *
+ * return 1 if pathnames are equal, else 0
+ */
static int cdev_name_equal(void *a, void *b)
{
+ size_t length_a, length_b;
+ char *str_a, *str_b;
+
if (!a || !b)
return 0;
- if (strncmp((char *)a, ((struct sysfs_class_device *)b)->name,
- strlen((char *)a)) == 0)
+ str_a = (char *)a;
+ str_b = ((struct sysfs_class_device *)b)->name;
+
+ length_a = strnlen(str_a, SYSFS_NAME_LEN+1);
+ length_b = strnlen(str_b, SYSFS_NAME_LEN+1);
+
+ if (length_a != length_b)
+ return 0;
+
+ if (strncmp(str_a, str_b, SYSFS_NAME_LEN+1) == 0)
return 1;
return 0;
--
1.8.3.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。