mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 18:08:12 +00:00
Kernel: Only open a single description for stdio in non-fork processes
This commit is contained in:
parent
603bf6fb4a
commit
7cc0b18f65
1 changed files with 4 additions and 3 deletions
|
@ -1210,9 +1210,10 @@ Process* Process::create_user_process(Thread*& first_thread, const String& path,
|
||||||
auto* process = new Process(first_thread, parts.take_last(), uid, gid, parent_pid, Ring3, move(cwd), nullptr, tty);
|
auto* process = new Process(first_thread, parts.take_last(), uid, gid, parent_pid, Ring3, move(cwd), nullptr, tty);
|
||||||
process->m_fds.resize(m_max_open_file_descriptors);
|
process->m_fds.resize(m_max_open_file_descriptors);
|
||||||
auto& device_to_use_as_tty = tty ? (CharacterDevice&)*tty : NullDevice::the();
|
auto& device_to_use_as_tty = tty ? (CharacterDevice&)*tty : NullDevice::the();
|
||||||
process->m_fds[0].set(*device_to_use_as_tty.open(O_RDONLY).value());
|
auto description = device_to_use_as_tty.open(O_RDWR).value();
|
||||||
process->m_fds[1].set(*device_to_use_as_tty.open(O_WRONLY).value());
|
process->m_fds[0].set(*description);
|
||||||
process->m_fds[2].set(*device_to_use_as_tty.open(O_WRONLY).value());
|
process->m_fds[1].set(*description);
|
||||||
|
process->m_fds[2].set(*description);
|
||||||
|
|
||||||
error = process->exec(path, move(arguments), move(environment));
|
error = process->exec(path, move(arguments), move(environment));
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue