From 44d4bf7a1b8da2bdcbaab7f7d32aac578a49f1d7 Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Mon, 17 Oct 2016 18:17:50 +0200 Subject: [PATCH] libc_pipe: ignore some flags in 'fcntl()' Ignore file access mode and file creation flags for the F_SETFL command. Fixes #2136 --- repos/libports/src/lib/libc_pipe/plugin.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/repos/libports/src/lib/libc_pipe/plugin.cc b/repos/libports/src/lib/libc_pipe/plugin.cc index 0be3cc5c47..e9e1254ea7 100644 --- a/repos/libports/src/lib/libc_pipe/plugin.cc +++ b/repos/libports/src/lib/libc_pipe/plugin.cc @@ -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 */