From 74a44f5aedcaac30d812a922af4586d505031bc7 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 14 Nov 2023 17:36:29 -0500 Subject: [PATCH] protocols/unix: Return EOPNOTSUPP when unhandled flags are specified. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the "bug" part of #18653 (however the flags still need to actually be implemented.) Change-Id: Icd296af8b409416317ba3d02735504729949fd08 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7109 Reviewed-by: Niels Sascha Reedijk Tested-by: Commit checker robot Reviewed-by: Jérôme Duval Reviewed-by: waddlesplash --- .../kernel/network/protocols/unix/UnixDatagramEndpoint.cpp | 6 ++++++ .../kernel/network/protocols/unix/UnixStreamEndpoint.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/add-ons/kernel/network/protocols/unix/UnixDatagramEndpoint.cpp b/src/add-ons/kernel/network/protocols/unix/UnixDatagramEndpoint.cpp index c497705a72..1e0be05e18 100644 --- a/src/add-ons/kernel/network/protocols/unix/UnixDatagramEndpoint.cpp +++ b/src/add-ons/kernel/network/protocols/unix/UnixDatagramEndpoint.cpp @@ -215,6 +215,9 @@ UnixDatagramEndpoint::Send(const iovec* vecs, size_t vecCount, TRACE("[%" B_PRId32 "] %p->UnixDatagramEndpoint::Send()\n", find_thread(NULL), this); + if ((flags & ~(MSG_DONTWAIT)) != 0) + return EOPNOTSUPP; + bigtime_t timeout = 0; if ((flags & MSG_DONTWAIT) == 0) { timeout = absolute_timeout(socket->send.timeout); @@ -325,6 +328,9 @@ UnixDatagramEndpoint::Receive(const iovec* vecs, size_t vecCount, TRACE("[%" B_PRId32 "] %p->UnixDatagramEndpoint::Receive()\n", find_thread(NULL), this); + if ((flags & ~(MSG_DONTWAIT)) != 0) + return EOPNOTSUPP; + bigtime_t timeout = 0; if ((flags & MSG_DONTWAIT) == 0) { timeout = absolute_timeout(socket->receive.timeout); diff --git a/src/add-ons/kernel/network/protocols/unix/UnixStreamEndpoint.cpp b/src/add-ons/kernel/network/protocols/unix/UnixStreamEndpoint.cpp index fc6e1a5e6b..698777bf80 100644 --- a/src/add-ons/kernel/network/protocols/unix/UnixStreamEndpoint.cpp +++ b/src/add-ons/kernel/network/protocols/unix/UnixStreamEndpoint.cpp @@ -379,6 +379,9 @@ UnixStreamEndpoint::Send(const iovec* vecs, size_t vecCount, TRACE("[%" B_PRId32 "] %p->UnixStreamEndpoint::Send(%p, %ld, %p)\n", find_thread(NULL), this, vecs, vecCount, ancillaryData); + if ((flags & ~(MSG_DONTWAIT)) != 0) + return EOPNOTSUPP; + bigtime_t timeout = 0; if ((flags & MSG_DONTWAIT) == 0) { timeout = absolute_timeout(socket->send.timeout); @@ -473,6 +476,9 @@ UnixStreamEndpoint::Receive(const iovec* vecs, size_t vecCount, TRACE("[%" B_PRId32 "] %p->UnixStreamEndpoint::Receive(%p, %ld)\n", find_thread(NULL), this, vecs, vecCount); + if ((flags & ~(MSG_DONTWAIT)) != 0) + return EOPNOTSUPP; + bigtime_t timeout = 0; if ((flags & MSG_DONTWAIT) == 0) { timeout = absolute_timeout(socket->receive.timeout);