public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: POSIX mq: avoid double calls to ipc_mutex_unlock
Date: Fri, 30 Apr 2021 08:36:20 +0000 (GMT)	[thread overview]
Message-ID: <20210430083620.D40BD385803D@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=548a4c3ca43543e66ec91df799379bc67a92804a

commit 548a4c3ca43543e66ec91df799379bc67a92804a
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Fri Apr 30 10:30:21 2021 +0200

    Cygwin: POSIX mq: avoid double calls to ipc_mutex_unlock
    
    _mq_send as well as _mq_receive call ipc_mutex_unlock twice in case
    of success, after having introduced __try/__except blocks.
    
    Fixes: 3f3bd10104550 ("* Throughout, use __try/__except/__endtry blocks, rather than myfault handler.")
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/posix_ipc.cc | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/winsup/cygwin/posix_ipc.cc b/winsup/cygwin/posix_ipc.cc
index c6a003c37..89ec7dbef 100644
--- a/winsup/cygwin/posix_ipc.cc
+++ b/winsup/cygwin/posix_ipc.cc
@@ -886,7 +886,6 @@ _mq_send (mqd_t mqd, const char *ptr, size_t len, unsigned int prio,
 	ipc_cond_signal (mqinfo->mqi_waitrecv);
       attr->mq_curmsgs++;
 
-      ipc_mutex_unlock (mqinfo->mqi_lock);
       ret = 0;
     }
   __except (EBADF) {}
@@ -986,8 +985,6 @@ _mq_receive (mqd_t mqd, char *ptr, size_t maxlen, unsigned int *priop,
       if (attr->mq_curmsgs == attr->mq_maxmsg)
 	ipc_cond_signal (mqinfo->mqi_waitsend);
       attr->mq_curmsgs--;
-
-      ipc_mutex_unlock (mqinfo->mqi_lock);
     }
   __except (EBADF) {}
   __endtry


                 reply	other threads:[~2021-04-30  8:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210430083620.D40BD385803D@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).