public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-developers@cygwin.com
Subject: Re: fixup_after_fork (NULL)
Date: Fri, 28 Feb 2020 14:50:00 -0000	[thread overview]
Message-ID: <20200228144957.GL4045@calimero.vinschen.de> (raw)
In-Reply-To: <20200228124143.GF4045@calimero.vinschen.de>

[-- Attachment #1: Type: text/plain, Size: 1292 bytes --]

On Feb 28 13:41, Corinna Vinschen wrote:
> On Feb 27 17:24, Ken Brown wrote:
> > fhandler_socket_wsock::fixup_after_exec and
> > fhandler_socket_unix::fixup_after_exec call fixup_after_fork (NULL), which
> > would seem to lead to calls to DuplicateHandle with first argument NULL.  I
> > can't find any documentation that says this is legal.  What do these calls
> > do?
> 
> They fail with ERROR_INVALID_HANDLE.
> 
> I checked the commit history and it turned out that this has been
> introduced with commit 528060195ca6c back in 2002.
> 
> In fhandler_socket_wsock it has no negative impact.  fixup_after_exec
> calls fixup_after_fork *only* on need_fixup_before(), that is, if the
> handle was some of the special LSP handles, so the socket handle has to
> be created by WSADuplicateSocket/WSASocket.  In that case the parent
> handle isn't needed.
> 
> Same in case of fhandler_pty_slave.  Its fixup_after_fork doesn't
> require the parent handle at all.
> 
> In case of fhandler_socket_unix, this was most likely a straight
> copy/paste or developer-didn't-actually-think-about-it-error.
> I fear it was the latter.  I have to start thinking about it...

This should be fixed now.  Thanks for noticing!


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2020-02-28 14:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 22:25 Ken Brown
2020-02-28 12:41 ` Corinna Vinschen
2020-02-28 14:50   ` Corinna Vinschen [this message]

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=20200228144957.GL4045@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin-developers@cygwin.com \
    /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).