UserspaceEmulator: Fix execve messing up command lines with "--"

Emulator::virt$execve would construct command lines such as
`/bin/UserspaceEmulator echo -- hello` instead of
`/bin/UserspaceEmulator -- echo hello`, which naturally caused problems.
This commit moves the "--" to the correct place.
This commit is contained in:
Rummskartoffel 2022-01-20 22:04:57 +01:00 committed by Idan Horowitz
parent 2cda579b07
commit d2f99c200f
Notes: sideshowbarker 2024-07-17 20:32:32 +09:00

View File

@ -1229,10 +1229,10 @@ int Emulator::virt$execve(FlatPtr params_addr)
Vector<char*> envp;
argv.append(const_cast<char*>("/bin/UserspaceEmulator"));
argv.append(const_cast<char*>(path.characters()));
if (g_report_to_debug)
argv.append(const_cast<char*>("--report-to-debug"));
argv.append(const_cast<char*>("--"));
argv.append(const_cast<char*>(path.characters()));
auto create_string_vector = [](auto& output_vector, auto& input_vector) {
for (auto& string : input_vector)