libc_pipe: ignore some flags in 'fcntl()'

Ignore file access mode and file creation flags for the F_SETFL command.

Fixes #2136
This commit is contained in:
Christian Prochaska 2016-10-17 18:17:50 +02:00 committed by Christian Helmuth
parent 964239aa7a
commit 44d4bf7a1b

View File

@ -246,12 +246,18 @@ namespace Libc_pipe {
case F_SETFL:
{
constexpr long supported_flags = O_NONBLOCK;
/*
* O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_EXCL
* are ignored
*/
constexpr long supported_flags = O_NONBLOCK
| O_RDONLY | O_WRONLY | O_RDWR
| O_CREAT | O_TRUNC | O_EXCL;
context(pipefdo)->set_nonblock(arg & O_NONBLOCK);
if ((arg & ~supported_flags) == 0)
break;
return 0;
/* unsupported flags present */