diff --git a/sched/mqueue/mq_send.c b/sched/mqueue/mq_send.c index 0df8c7b2b8..4ca49d54d5 100644 --- a/sched/mqueue/mq_send.c +++ b/sched/mqueue/mq_send.c @@ -216,7 +216,7 @@ int nxmq_send(mqd_t mqdes, FAR const char *msg, size_t msglen, * EAGAIN The queue was full and the O_NONBLOCK flag was set for the * message queue description referred to by mqdes. * EINVAL Either msg or mqdes is NULL or the value of prio is invalid. - * EPERM Message queue opened not opened for writing. + * EBADF Message queue opened not opened for writing. * EMSGSIZE 'msglen' was greater than the maxmsgsize attribute of the * message queue. * EINTR The call was interrupted by a signal handler. diff --git a/sched/mqueue/mq_sndinternal.c b/sched/mqueue/mq_sndinternal.c index fe0af476fb..eceff480e5 100644 --- a/sched/mqueue/mq_sndinternal.c +++ b/sched/mqueue/mq_sndinternal.c @@ -66,7 +66,7 @@ * returned. * * EINVAL Either msg or msgq is NULL or the value of prio is invalid. - * EPERM Message queue opened not opened for writing. + * EBADF Message queue opened not opened for writing. * EMSGSIZE 'msglen' was greater than the maxmsgsize attribute of the * message queue. * @@ -88,14 +88,14 @@ int nxmq_verify_send(FAR FAR struct file *mq, FAR const char *msg, /* Verify the input parameters */ - if (msg == NULL || msgq == NULL || prio > MQ_PRIO_MAX) + if (msg == NULL || msgq == NULL || prio >= MQ_PRIO_MAX) { return -EINVAL; } if ((mq->f_oflags & O_WROK) == 0) { - return -EPERM; + return -EBADF; } if (msglen > (size_t)msgq->maxmsgsize)