From e3b228f098c89bb4e382bb091a7888f3cc807454 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 30 Apr 2021 20:56:31 +0200 Subject: [PATCH] never block when peeking --- winsup/cygwin/posix_ipc.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/posix_ipc.cc b/winsup/cygwin/posix_ipc.cc index 1f13c2298..1e5e40144 100644 --- a/winsup/cygwin/posix_ipc.cc +++ b/winsup/cygwin/posix_ipc.cc @@ -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;