From 58bc10b9476508dbfe5e552c2019c1dc7531f0f8 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Thu, 27 May 2021 21:14:57 +0200 Subject: [PATCH] Kernel: Make dup2() return the fd even if old & new are the same (#7506) --- Kernel/Syscalls/dup2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/Syscalls/dup2.cpp b/Kernel/Syscalls/dup2.cpp index 485dd5c10f..46b30aeae6 100644 --- a/Kernel/Syscalls/dup2.cpp +++ b/Kernel/Syscalls/dup2.cpp @@ -16,7 +16,7 @@ KResultOr 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);