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] forkables: use dynloaded dll's IndexNumber as dirname
Date: Fri, 08 Feb 2019 11:38:00 -0000	[thread overview]
Message-ID: <20190208113808.41128.qmail@sourceware.org> (raw)

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

commit 8bbb3d3a23e4d3ab8e707168f1c6bd7b0e19f6df
Author: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date:   Thu Jan 12 10:03:52 2017 +0100

    forkables: use dynloaded dll's IndexNumber as dirname

Diff:
---
 winsup/cygwin/forkable.cc | 33 ++++++++-------------------------
 1 file changed, 8 insertions(+), 25 deletions(-)

diff --git a/winsup/cygwin/forkable.cc b/winsup/cygwin/forkable.cc
index da45643..c569b0f 100644
--- a/winsup/cygwin/forkable.cc
+++ b/winsup/cygwin/forkable.cc
@@ -409,34 +409,17 @@ dll::nominate_forkable (PCWCHAR dirx_name)
   if (!*forkable_ntname)
     return; /* denominate */
 
-  if (type < DLL_LOAD)
-    wcpcpy (next, modname);
-  else
+  if (type == DLL_LOAD)
     {
-      /* Avoid lots of extra directories for loaded dll's:
-       * mangle full path into one single directory name,
-       * just keep original filename intact. The original
-       * filename is necessary to serve as linked
-       * dependencies of dynamically loaded dlls. */
-      PWCHAR lastpathsep = wcsrchr (ntname, L'\\');
-      if (!lastpathsep)
-        {
-	  forkable_ntname = NULL;
-	  return;
-	}
-      *lastpathsep = L'\0';
-      HANDLE fh = dll_list::ntopenfile (ntname, NULL, FILE_DIRECTORY_FILE);
-      *lastpathsep = L'\\';
-
-      FILE_INTERNAL_INFORMATION fii = { 0 };
-      if (fh != INVALID_HANDLE_VALUE)
-	{
-	  dll_list::read_fii (fh, &fii);
-	  NtClose (fh);
-	}
+      /* Multiple dynamically loaded dlls can have identical basenames
+       * when loaded from different directories.  But still the original
+       * basename may serve as linked dependency for another dynamically
+       * loaded dll.  So we have to create a separate directory for the
+       * dynamically loaded dll - using the dll's IndexNumber as name. */
       next += format_IndexNumber (next, -1, &fii.IndexNumber);
-      wcpcpy (next, lastpathsep);
+      next = wcpcpy (next, L"\\");
     }
+  wcpcpy (next, modname);
 }
 
 /* Create the nominated hardlink for one indivitual dll,


                 reply	other threads:[~2019-02-08 11:38 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=20190208113808.41128.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).