Kernel: Make dup2() return the fd even if old & new are the same (#7506)

This commit is contained in:
Tim Schumacher 2021-05-27 21:14:57 +02:00 committed by GitHub
parent 97d0ebba20
commit 58bc10b947
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,7 +16,7 @@ KResultOr<int> Process::sys$dup2(int old_fd, int new_fd)
if (!description)
return EBADF;
if (old_fd == new_fd)
return 0;
return new_fd;
if (new_fd < 0 || new_fd >= m_max_open_file_descriptors)
return EINVAL;
m_fds[new_fd].set(*description);