Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/dll_init.cc')
-rw-r--r--winsup/cygwin/dll_init.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc
index 51ef186a3..313b0ff93 100644
--- a/winsup/cygwin/dll_init.cc
+++ b/winsup/cygwin/dll_init.cc
@@ -25,6 +25,7 @@ details. */
#include <wchar.h>
#include <sys/reent.h>
#include <assert.h>
+#include <tls_pbuf.h>
extern void __stdcall check_sanity_and_sync (per_process *);
@@ -178,7 +179,9 @@ dll_list::find_by_modname (const PWCHAR modname)
dll *
dll_list::alloc (HINSTANCE h, per_process *p, dll_type type)
{
- WCHAR buf[NT_MAX_PATH];
+ /* Called under loader lock conditions so this function can't be called
+ multiple times in parallel. A static buffer is safe. */
+ static WCHAR buf[NT_MAX_PATH];
GetModuleFileNameW (h, buf, NT_MAX_PATH);
PWCHAR name = buf;
if (!wcsncmp (name, L"\\\\?\\", 4))
@@ -264,7 +267,9 @@ dll_list::append (dll* d)
void dll_list::populate_deps (dll* d)
{
- WCHAR wmodname[NT_MAX_PATH];
+ tmp_pathbuf tp;
+
+ PWCHAR wmodname = tp.w_get ();
pefile* pef = (pefile*) d->handle;
PIMAGE_DATA_DIRECTORY dd = pef->idata_dir (IMAGE_DIRECTORY_ENTRY_IMPORT);
/* Annoyance: calling crealloc with a NULL pointer will use the