libc: Handle dup2 with two equal arguments

This commit is contained in:
Norman Feske 2013-02-21 16:39:46 +01:00
parent fbd4b5f6df
commit 1009d00168

View File

@ -340,6 +340,9 @@ extern "C" int _dup2(int libc_fd, int new_libc_fd)
if (!fd || !fd->plugin)
return INVALID_FD;
if (libc_fd == new_libc_fd)
return libc_fd;
/*
* Check if 'new_libc_fd' is already in use. If so, close it before
* allocating it again.