From 6fef29ae45b93c6f2c529be7dd631aa92ecb57d6 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 15 Jan 2005 21:43:07 +0000 Subject: [PATCH] * Changed return value of read_port[_etc] from status_t to ssize_t. That's not how it is declared in R5, but it is what actually is returned. * Fixed _user_read_port_etc(): It didn't copy the message code back to userland, if the message had a size > 0. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10759 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/port.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/kernel/core/port.c b/src/kernel/core/port.c index c00566b11e..56cdf706f4 100644 --- a/src/kernel/core/port.c +++ b/src/kernel/core/port.c @@ -851,14 +851,14 @@ port_count(port_id id) } -status_t +ssize_t read_port(port_id port, int32 *msgCode, void *msgBuffer, size_t bufferSize) { return read_port_etc(port, msgCode, msgBuffer, bufferSize, 0, 0); } -status_t +ssize_t read_port_etc(port_id id, int32 *_msgCode, void *msgBuffer, size_t bufferSize, uint32 flags, bigtime_t timeout) { @@ -1208,7 +1208,7 @@ _user_port_count(port_id port) } -status_t +ssize_t _user_read_port_etc(port_id port, int32 *userCode, void *userBuffer, size_t bufferSize, uint32 flags, bigtime_t timeout) { @@ -1223,7 +1223,7 @@ _user_read_port_etc(port_id port, int32 *userCode, void *userBuffer, status = read_port_etc(port, &messageCode, userBuffer, bufferSize, flags | PORT_FLAG_USE_USER_MEMCPY | B_CAN_INTERRUPT, timeout); - if (status == B_OK && user_memcpy(userCode, &messageCode, sizeof(int32)) < B_OK) + if (status >= 0 && user_memcpy(userCode, &messageCode, sizeof(int32)) < B_OK) return B_BAD_ADDRESS; return status;