mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Only open a single description for stdio in non-fork processes
This commit is contained in:
parent
603bf6fb4a
commit
7cc0b18f65
Notes:
sideshowbarker
2024-07-19 09:50:01 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/7cc0b18f657
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);
|
||||
process->m_fds.resize(m_max_open_file_descriptors);
|
||||
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());
|
||||
process->m_fds[1].set(*device_to_use_as_tty.open(O_WRONLY).value());
|
||||
process->m_fds[2].set(*device_to_use_as_tty.open(O_WRONLY).value());
|
||||
auto description = device_to_use_as_tty.open(O_RDWR).value();
|
||||
process->m_fds[0].set(*description);
|
||||
process->m_fds[1].set(*description);
|
||||
process->m_fds[2].set(*description);
|
||||
|
||||
error = process->exec(path, move(arguments), move(environment));
|
||||
if (error != 0) {
|
||||
|
|
Loading…
Reference in a new issue