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: AF_UNIX: fix creating shared mem region in dup
Date: Fri, 28 Feb 2020 11:42:00 -0000 [thread overview]
Message-ID: <20200228114256.29528.qmail@sourceware.org> (raw)
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=92b8b300c26c20ea441f69b36da9a838aa85c2d8
commit 92b8b300c26c20ea441f69b36da9a838aa85c2d8
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Fri Feb 28 12:39:41 2020 +0100
Cygwin: AF_UNIX: fix creating shared mem region in dup
reopen_shmem is accidentally called on the parent fhandler
rather than the child fhandler, and it's called too early.
Make sure to call it on the child and only after its shmem_handle
is valid.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/fhandler_socket_unix.cc | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc
index eea7e76..824bcba 100644
--- a/winsup/cygwin/fhandler_socket_unix.cc
+++ b/winsup/cygwin/fhandler_socket_unix.cc
@@ -1201,12 +1201,6 @@ fhandler_socket_unix::dup (fhandler_base *child, int flags)
return -1;
}
fhandler_socket_unix *fhs = (fhandler_socket_unix *) child;
- if (reopen_shmem () < 0)
- {
- __seterrno ();
- fhs->close ();
- return -1;
- }
if (backing_file_handle && backing_file_handle != INVALID_HANDLE_VALUE
&& !DuplicateHandle (GetCurrentProcess (), backing_file_handle,
GetCurrentProcess (), &fhs->backing_file_handle,
@@ -1224,6 +1218,12 @@ fhandler_socket_unix::dup (fhandler_base *child, int flags)
fhs->close ();
return -1;
}
+ if (fhs->reopen_shmem () < 0)
+ {
+ __seterrno ();
+ fhs->close ();
+ return -1;
+ }
fhs->sun_path (sun_path ());
fhs->peer_sun_path (peer_sun_path ());
fhs->connect_wait_thr = NULL;
reply other threads:[~2020-02-28 11:42 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=20200228114256.29528.qmail@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).