From 9fc2f5912a3fa2fa5a61c62f85a8a81e459f2965 Mon Sep 17 00:00:00 2001
From: zhangyao2022 <zhangyao108@huawei.com>
Date: Wed, 10 Apr 2024 17:16:04 +0800
Subject: [PATCH] fix: read pid cmdline incorrect

---
 libs/basic/src/cmdline.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libs/basic/src/cmdline.rs b/libs/basic/src/cmdline.rs
index 52cdf5c3..952ec34f 100644
--- a/libs/basic/src/cmdline.rs
+++ b/libs/basic/src/cmdline.rs
@@ -48,8 +48,8 @@ impl Cmdline {
         if let Ok(mut file) = File::open(path) {
             let mut data = String::new();
             if file.read_to_string(&mut data).is_ok() {
-                *cmdline = data.clone();
-                for item in data.split_whitespace() {
+                *cmdline = data.replace("\0", " ").trim().to_string();
+                for item in cmdline.split_whitespace() {
                     let mut parts = item.splitn(2, '=');
                     let key = parts.next().unwrap_or_default().to_string();
                     let value = parts.next().map(|v| v.to_string());
-- 
2.33.0

