35 lines
1.4 KiB
Diff
35 lines
1.4 KiB
Diff
|
|
From df915cbcc72f0ac8c220e40a62eb6da050057c3e Mon Sep 17 00:00:00 2001
|
|||
|
|
From: tangjie02 <tangjie02@kylinsec.com.cn>
|
|||
|
|
Date: Thu, 4 Jul 2024 19:39:36 +0800
|
|||
|
|
Subject: [PATCH 19/22] fix(systeminfo): Remove the duplicate graphical and
|
|||
|
|
network hardware info.
|
|||
|
|
MIME-Version: 1.0
|
|||
|
|
Content-Type: text/plain; charset=UTF-8
|
|||
|
|
Content-Transfer-Encoding: 8bit
|
|||
|
|
|
|||
|
|
- 移除重复的显卡和网络设备
|
|||
|
|
|
|||
|
|
Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
|
|||
|
|
---
|
|||
|
|
plugins/systeminfo/systeminfo-hardware.cpp | 4 ++++
|
|||
|
|
1 file changed, 4 insertions(+)
|
|||
|
|
|
|||
|
|
diff --git a/plugins/systeminfo/systeminfo-hardware.cpp b/plugins/systeminfo/systeminfo-hardware.cpp
|
|||
|
|
index 73960f7..8ccb0e4 100644
|
|||
|
|
--- a/plugins/systeminfo/systeminfo-hardware.cpp
|
|||
|
|
+++ b/plugins/systeminfo/systeminfo-hardware.cpp
|
|||
|
|
@@ -355,6 +355,10 @@ KVList SystemInfoHardware::get_pcis_by_major_class_id(PCIMajorClassID major_clas
|
|||
|
|
// 如果为空则不执行下面的命令,否则会取到所有的PCI设备(没有了-d选项的限制)
|
|||
|
|
RETURN_VAL_IF_TRUE(full_class_ids.size() == 0, KVList());
|
|||
|
|
|
|||
|
|
+ // 对full_class_ids去重
|
|||
|
|
+ std::sort(full_class_ids.begin(), full_class_ids.end());
|
|||
|
|
+ full_class_ids.erase(std::unique(full_class_ids.begin(), full_class_ids.end()), full_class_ids.end());
|
|||
|
|
+
|
|||
|
|
// 根据full_class_id列表获取设备相关信息
|
|||
|
|
std::string full_outputs;
|
|||
|
|
for (auto& full_class_id : full_class_ids)
|
|||
|
|
--
|
|||
|
|
2.27.0
|
|||
|
|
|