never block when peeking

This commit is contained in:
Corinna Vinschen 2021-04-30 20:56:31 +02:00
parent 85d0081f0e
commit e3b228f098
1 changed files with 2 additions and 1 deletions

View File

@ -966,7 +966,8 @@ _mq_receive (mqd_t mqd, char *ptr, size_t maxlen, unsigned int *priop,
}
if (attr->mq_curmsgs == 0) /* queue is empty */
{
if (mqinfo->mqi_flags & O_NONBLOCK)
/* Don't block if O_NONBLOCK is set or when peeking */
if ((mqinfo->mqi_flags & O_NONBLOCK) || (flags & _MQ_PEEK_PACKET))
{
set_errno (EAGAIN);
__leave;