public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: dll_list: no recursive use of nt_max_path_buf
@ 2019-06-03 16:38 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2019-06-03 16:38 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=a9c27900e3d98fa4e57405e7abc10c260f2167d2
commit a9c27900e3d98fa4e57405e7abc10c260f2167d2
Author: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Mon May 13 16:36:23 2019 +0200
Cygwin: dll_list: no recursive use of nt_max_path_buf
Querying the ntlength and existence of the /var/run/cygfork directory in
the very first Cygwin process should not use nt_max_path_buf, as that
one is used by dll_list::alloc already.
Diff:
---
winsup/cygwin/forkable.cc | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/winsup/cygwin/forkable.cc b/winsup/cygwin/forkable.cc
index 4fbc2ab..350a95c 100644
--- a/winsup/cygwin/forkable.cc
+++ b/winsup/cygwin/forkable.cc
@@ -472,17 +472,21 @@ dll_list::forkable_ntnamesize (dll_type type, PCWCHAR fullntname, PCWCHAR modnam
if (cygwin_shared->forkable_hardlink_support == 0) /* Unknown */
{
/* check existence of forkables dir */
- PWCHAR pbuf = nt_max_path_buf ();
+ /* nt_max_path_buf () is already used in dll_list::alloc.
+ But as this is run in the very first cygwin process only,
+ using some heap is not a performance issue here. */
+ PWCHAR pbuf = (PWCHAR) cmalloc_abort (HEAP_BUF,
+ NT_MAX_PATH * sizeof (WCHAR));
+ PWCHAR pnext = pbuf;
for (namepart const *part = forkable_nameparts; part->text; ++part)
{
if (part->textfunc)
- pbuf += part->textfunc (pbuf, -1);
+ pnext += part->textfunc (pnext, -1);
else
- pbuf += __small_swprintf (pbuf, L"%W", part->text);
+ pnext += __small_swprintf (pnext, L"%W", part->text);
if (part->mutex_from_dir)
break; /* up to first mutex-naming dir */
}
- pbuf = nt_max_path_buf ();
UNICODE_STRING fn;
RtlInitUnicodeString (&fn, pbuf);
@@ -504,6 +508,7 @@ dll_list::forkable_ntnamesize (dll_type type, PCWCHAR fullntname, PCWCHAR modnam
cygwin_shared->forkable_hardlink_support = -1; /* No */
debug_printf ("disabled, missing or not on NTFS %W", fn.Buffer);
}
+ cfree (pbuf);
}
if (!forkables_supported ())
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-06-03 16:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-03 16:38 [newlib-cygwin] Cygwin: dll_list: no recursive use of nt_max_path_buf 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).