public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: POSIX msg queues: simplify mq_close
@ 2021-05-25 14:56 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2021-05-25 14:56 UTC (permalink / raw)
  To: cygwin-cvs

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

commit 2cc914a34e505e7ce13b18d0f517b58a996a2d1e
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Tue May 25 16:36:09 2021 +0200

    Cygwin: POSIX msg queues: simplify mq_close
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/fhandler_mqueue.cc | 5 ++---
 winsup/cygwin/posix_ipc.cc       | 5 +----
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/winsup/cygwin/fhandler_mqueue.cc b/winsup/cygwin/fhandler_mqueue.cc
index 6fc17c28c..5f97264cd 100644
--- a/winsup/cygwin/fhandler_mqueue.cc
+++ b/winsup/cygwin/fhandler_mqueue.cc
@@ -180,9 +180,8 @@ fhandler_mqueue::close ()
       NtClose (mqinfo ()->mqi_waitsend);
       NtClose (mqinfo ()->mqi_waitrecv);
       NtClose (mqinfo ()->mqi_lock);
-      ret = 0;
     }
-  __except (EFAULT) {}
+  __except (0) {}
   __endtry
-  return ret;
+  return 0;
 }
diff --git a/winsup/cygwin/posix_ipc.cc b/winsup/cygwin/posix_ipc.cc
index 8101a28f9..1f913c8d7 100644
--- a/winsup/cygwin/posix_ipc.cc
+++ b/winsup/cygwin/posix_ipc.cc
@@ -882,13 +882,10 @@ mq_timedreceive (mqd_t mqd, char *ptr, size_t maxlen, unsigned int *priop,
 extern "C" int
 mq_close (mqd_t mqd)
 {
-  struct mq_info *mqinfo;
-
   __try
     {
       cygheap_fdget fd ((int) mqd, true);
-      mqinfo = get_mqinfo (fd);
-      if (mqinfo->mqi_magic != MQI_MAGIC)
+      if (!fd->is_mqueue ())
 	{
 	  set_errno (EBADF);
 	  __leave;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-25 14:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 14:56 [newlib-cygwin] Cygwin: POSIX msg queues: simplify mq_close Corinna Vinschen

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).