sysmaster/backport-replaced-argv0-with-the-absolute-path.patch
2022-09-13 14:13:31 +08:00

31 lines
1.2 KiB
Diff

From cbe3cc5daf87c605548d46800fd6c719d8582f95 Mon Sep 17 00:00:00 2001
From: Xiaoguang Li <lixiaoguang2@huawei.com>
Date: Mon, 5 Sep 2022 23:54:03 +0800
Subject: [PATCH 1/4] replaced argv0 with the absolute path
---
process1/src/manager/unit/execute/exec_spawn.rs | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/process1/src/manager/unit/execute/exec_spawn.rs b/process1/src/manager/unit/execute/exec_spawn.rs
index 303e363..d41af93 100755
--- a/process1/src/manager/unit/execute/exec_spawn.rs
+++ b/process1/src/manager/unit/execute/exec_spawn.rs
@@ -111,12 +111,8 @@ fn build_run_args(
cmdline: &ExecCommand,
env: &ExecParameters,
) -> (std::ffi::CString, Vec<std::ffi::CString>) {
- // let command = cmdline.borrow();
let cmd = std::ffi::CString::new(cmdline.path().clone()).unwrap();
-
- let exec_name = std::path::PathBuf::from(cmdline.path());
- let exec_name = exec_name.file_name().unwrap().to_str().unwrap();
- let exec_name = std::ffi::CString::new::<Vec<u8>>(exec_name.bytes().collect()).unwrap();
+ let exec_name = std::ffi::CString::new(cmdline.path().clone()).unwrap();
let mut args = Vec::new();
args.push(exec_name);
--
2.30.2