2
0
mirror of https://github.com/boostorg/process.git synced 2026-01-26 18:52:25 +00:00

OpenBSD fix & Solaris fixes

[DragonFly BSD] Use Proper CWD From PID Code
This commit is contained in:
Samuel Venable
2024-10-27 17:49:44 +08:00
committed by Klemens Morgenstern
parent 817128108a
commit 8a8ca8b7ab
6 changed files with 92 additions and 10 deletions

View File

@@ -357,7 +357,6 @@ shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
}
else
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec);
kvm_close(kd);
return {};
}
@@ -368,7 +367,7 @@ shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
char **cmd = nullptr;
proc *proc_info = nullptr;
user *proc_user = nullptr;
kd = kvm_open(nullptr, nullptr, nullptr, O_RDONLY, nullptr);
kvm_t *kd = kvm_open(nullptr, nullptr, nullptr, O_RDONLY, nullptr);
if (!kd) {BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec) return {};}
if ((proc_info = kvm_getproc(kd, pid)))
{
@@ -379,9 +378,11 @@ shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
int argc = 0;
for (int i = 0; cmd[i] != nullptr; i++)
argc ++;
return make_cmd_shell_::make(
shell res = make_cmd_shell_::make(
{}, argc, cmd,
+[](int, char ** argv) {::free(argv);})
kvm_close(kd);
return res;
}
else
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec);