2
0
mirror of https://github.com/boostorg/process.git synced 2026-01-20 04:42:24 +00:00

Compare commits

..

3 Commits

Author SHA1 Message Date
Klemens
c4ba43e970 FreeBSD fix 2023-02-07 19:30:35 +08:00
Klemens Morgenstern
19212708e5 ec use locations. 2023-02-07 17:48:54 +08:00
Klemens Morgenstern
42ba48f744 xproc fixes 2023-02-07 17:48:54 +08:00
3 changed files with 7 additions and 5 deletions

View File

@@ -92,12 +92,13 @@ struct make_cmd_shell_
str_lengths += (std::strlen(*c) + 1);
}
// yes, not the greatest solution.
std::string buffer;
res.buffer_.resize(str_lengths);
res.argv_ = new char*[res.argc_ + 1];
res.free_argv_ = +[](int argc, char ** argv) {delete[] argv;};
res.argv_[res.argc_] = nullptr;
auto p = &*res.buffer_.begin();
auto p = &buffer[sizeof(int) * (res.argc_) + 1];
for (int i = 0; i < res.argc_; i++)
{
@@ -304,8 +305,9 @@ shell cmd(boost::process::v2::pid_type pid, boost::system::error_code & ec)
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)
return {};
}
auto res = make_cmd_shell_::clone(cmd);
procstat_freeargv(proc_stat.get());
procstat_freeargv(proc_stat);
return res;
}

View File

@@ -342,7 +342,7 @@ env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
{
auto eno = reinterpret_cast<char**>(out);
auto eeo = eno;
auto str = out + (n * sizeof(char*)) + sizeof(char*);
auto str = out + (n * sizeof(char*)) + sizeof(char*);
e = env;
while (*e != nullptr)
{
@@ -351,11 +351,11 @@ env_view env(boost::process::v2::pid_type pid, boost::system::error_code & ec)
*eno = str;
str += len;
eno ++;
e++;
}
*eno = nullptr;
ev.handle_.reset(eeo);
}
else
BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec)

View File

@@ -115,7 +115,7 @@ void shell::parse_()
shell::~shell()
{
if (argv_ != nullptr && free_argv_ != nullptr)
if (argv_ != nullptr && free_argv_)
free_argv_(argc_, argv_);
}