Fix dup3(2) O_CLOEXEC and O_CLOFORK handling.

This commit is contained in:
Jonas 'Sortie' Termansen 2016-01-08 00:36:14 +01:00
parent ee9ec2eda1
commit 055f502c02
1 changed files with 2 additions and 2 deletions

View File

@ -148,8 +148,8 @@ int sys_dup3(int oldfd, int newfd, int flags)
if ( flags & ~(O_CLOEXEC | O_CLOFORK) )
return errno = EINVAL, -1;
int fd_flags = 0;
flags |= flags & O_CLOEXEC ? FD_CLOEXEC : 0;
flags |= flags & O_CLOFORK ? FD_CLOFORK : 0;
fd_flags |= flags & O_CLOEXEC ? FD_CLOEXEC : 0;
fd_flags |= flags & O_CLOFORK ? FD_CLOFORK : 0;
Ref<DescriptorTable> dtable = CurrentProcess()->GetDTable();
return dtable->Copy(oldfd, newfd, fd_flags);
}