sched/mqueue/mq_receive: fix the wrong return value when message queue is not opened for reading.

In POSIX testcase "open_posix_testsuite/conformance/interfaces/mq_receive/11-2.c", it will return "EPERM" when message queue is not opened for reading, but the standard POSIX specification in URL “https://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_receive.html” requires that "EBADF" be returned.So in this change, i update it.

Signed-off-by: yangjiao <yangjiao@xiaomi.com>
This commit is contained in:
yangjiao 2023-06-09 10:13:19 +08:00 committed by Xiang Xiao
parent b14cb6ccb4
commit 391bf7b37c
2 changed files with 3 additions and 3 deletions

View File

@ -62,7 +62,7 @@
* On success, zero (OK) is returned. A negated errno value is returned
* on any failure:
*
* EPERM Message queue opened not opened for reading.
* EBADF Message queue opened not opened for reading.
* EMSGSIZE 'msglen' was less than the maxmsgsize attribute of the message
* queue.
* EINVAL Invalid 'msg' or 'msgq'
@ -91,7 +91,7 @@ int nxmq_verify_receive(FAR struct file *mq, FAR char *msg, size_t msglen)
if ((mq->f_oflags & O_RDOK) == 0)
{
return -EPERM;
return -EBADF;
}
if (msglen < (size_t)msgq->maxmsgsize)

View File

@ -192,7 +192,7 @@ ssize_t nxmq_receive(mqd_t mqdes, FAR char *msg, size_t msglen,
*
* EAGAIN The queue was empty, and the O_NONBLOCK flag was set
* for the message queue description referred to by 'mqdes'.
* EPERM Message queue opened not opened for reading.
* EBADF Message queue opened not opened for reading.
* EMSGSIZE 'msglen' was less than the maxmsgsize attribute of the
* message queue.
* EINTR The call was interrupted by a signal handler.