libroot/unistd: dup3 should return EINVAL if oldFD == newFD.
As per POSIX-2024. Fixes #19476.
This commit is contained in:
@@ -22,12 +22,14 @@ dup(int fd)
|
|||||||
int
|
int
|
||||||
dup2(int oldFD, int newFD)
|
dup2(int oldFD, int newFD)
|
||||||
{
|
{
|
||||||
return dup3(oldFD, newFD, 0);
|
RETURN_AND_SET_ERRNO(_kern_dup2(oldFD, newFD, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
dup3(int oldFD, int newFD, int flags)
|
dup3(int oldFD, int newFD, int flags)
|
||||||
{
|
{
|
||||||
|
if (oldFD == newFD)
|
||||||
|
RETURN_AND_SET_ERRNO(EINVAL);
|
||||||
RETURN_AND_SET_ERRNO(_kern_dup2(oldFD, newFD, flags));
|
RETURN_AND_SET_ERRNO(_kern_dup2(oldFD, newFD, flags));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user