From 0b111f38f951b974c7cfa4d9ddc299529a9181fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 27 Jan 2005 07:08:17 +0000 Subject: [PATCH] read_port() and write_port() must accept a NULL pointer as buffer if the bufferSize is zero. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11084 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/port.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/kernel/core/port.c b/src/kernel/core/port.c index 56cdf706f4..3e944ad6af 100644 --- a/src/kernel/core/port.c +++ b/src/kernel/core/port.c @@ -1208,6 +1208,13 @@ _user_port_count(port_id port) } +status_t +_user_set_port_owner(port_id port, team_id team) +{ + return set_port_owner(port, team); +} + + ssize_t _user_read_port_etc(port_id port, int32 *userCode, void *userBuffer, size_t bufferSize, uint32 flags, bigtime_t timeout) @@ -1215,9 +1222,9 @@ _user_read_port_etc(port_id port, int32 *userCode, void *userBuffer, int32 messageCode; ssize_t status; - if (userCode == NULL || userBuffer == NULL) + if (userCode == NULL || (userBuffer == NULL && bufferSize != 0)) return B_BAD_VALUE; - if (!IS_USER_ADDRESS(userCode) || !IS_USER_ADDRESS(userBuffer)) + if (!IS_USER_ADDRESS(userCode) || (userBuffer != NULL && !IS_USER_ADDRESS(userBuffer))) return B_BAD_ADDRESS; status = read_port_etc(port, &messageCode, userBuffer, bufferSize, @@ -1230,20 +1237,13 @@ _user_read_port_etc(port_id port, int32 *userCode, void *userBuffer, } -status_t -_user_set_port_owner(port_id port, team_id team) -{ - return set_port_owner(port, team); -} - - status_t _user_write_port_etc(port_id port, int32 messageCode, const void *userBuffer, size_t bufferSize, uint32 flags, bigtime_t timeout) { - if (userBuffer == NULL) + if (userBuffer == NULL && bufferSize != 0) return B_BAD_VALUE; - if (!IS_USER_ADDRESS(userBuffer)) + if (userBuffer != NULL && !IS_USER_ADDRESS(userBuffer)) return B_BAD_ADDRESS; return write_port_etc(port, messageCode, userBuffer, bufferSize,