Cygwin: cygheap: Initialize myself_pinfo before child_copy().
After the commit30add3e6b3
, the problem: https://cygwin.com/pipermail/cygwin/2022-December/252759.html occurs rarely. It seems that myself_pinfo should be initialized where the timing before child_copy() and after cygheap allocation. This patch moves the initialization there. Fixes:30add3e6b3
("Cygwin: exec: don't access cygheap before it's initialized") Reported-by: Brian Inglis <Brian.Inglis@Shaw.ca> Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
This commit is contained in:
parent
7c14e5a10a
commit
a81fef51cf
|
@ -631,8 +631,6 @@ child_info_spawn::handle_spawn ()
|
||||||
if (!dynamically_loaded || get_parent_handle ())
|
if (!dynamically_loaded || get_parent_handle ())
|
||||||
{
|
{
|
||||||
cygheap_fixup_in_child (true);
|
cygheap_fixup_in_child (true);
|
||||||
if (dynamically_loaded)
|
|
||||||
moreinfo->myself_pinfo = NULL;
|
|
||||||
memory_init ();
|
memory_init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,8 @@ cygheap_fixup_in_child (bool execed)
|
||||||
cygheap = (init_cygheap *) VirtualAlloc ((LPVOID) CYGHEAP_STORAGE_LOW,
|
cygheap = (init_cygheap *) VirtualAlloc ((LPVOID) CYGHEAP_STORAGE_LOW,
|
||||||
commit_size, MEM_COMMIT,
|
commit_size, MEM_COMMIT,
|
||||||
PAGE_READWRITE);
|
PAGE_READWRITE);
|
||||||
|
if (dynamically_loaded && execed)
|
||||||
|
spawn_info->moreinfo->myself_pinfo = NULL;
|
||||||
cygheap_max = child_proc_info->cygheap_max;
|
cygheap_max = child_proc_info->cygheap_max;
|
||||||
child_copy (child_proc_info->parent, false, child_proc_info->silentfail (),
|
child_copy (child_proc_info->parent, false, child_proc_info->silentfail (),
|
||||||
"cygheap", cygheap, cygheap_max, NULL);
|
"cygheap", cygheap, cygheap_max, NULL);
|
||||||
|
|
Loading…
Reference in New Issue