diff --git a/sched/mqueue/mq_rcvinternal.c b/sched/mqueue/mq_rcvinternal.c index 19112b5852..91c2f9009d 100644 --- a/sched/mqueue/mq_rcvinternal.c +++ b/sched/mqueue/mq_rcvinternal.c @@ -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) diff --git a/sched/mqueue/mq_receive.c b/sched/mqueue/mq_receive.c index 89725e3304..eecae0c480 100644 --- a/sched/mqueue/mq_receive.c +++ b/sched/mqueue/mq_receive.c @@ -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.