* mmap.cc (fixup_mmaps_after_fork): Copy protection to child process.

Change ambiguous debug output.
This commit is contained in:
Corinna Vinschen 2003-01-14 21:01:43 +00:00
parent 857b65ddba
commit 15996b6f08
2 changed files with 20 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2003-01-14 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (fixup_mmaps_after_fork): Copy protection to child process.
Change ambiguous debug output.
2003-01-14 Corinna Vinschen <corinna@vinschen.de> 2003-01-14 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (mmap_record::access): Change argument type to caddr_t * mmap.cc (mmap_record::access): Change argument type to caddr_t

View File

@ -1006,21 +1006,29 @@ fixup_mmaps_after_fork (HANDLE parent)
} }
else else
{ {
BOOL ret, ret2; BOOL ret;
DWORD dummy_prot;
ret = ReadProcessMemory (parent, address, address, ret = ReadProcessMemory (parent, address, address,
getpagesize (), NULL); getpagesize (), NULL);
ret2 = VirtualProtectEx(parent, if (!VirtualProtectEx(parent,
address, getpagesize (), address, getpagesize (),
old_prot, &old_prot); old_prot, &dummy_prot))
if (!ret2) system_printf ("WARNING: VirtualProtectEx to "
system_printf ("WARNING: VirtualProtectEx to"
"return to previous state " "return to previous state "
"in parent failed for " "in parent failed for "
"MAP_PRIVATE address %p, %E", "MAP_PRIVATE address %p, %E",
rec->get_address ()); rec->get_address ());
if (!VirtualProtect (address, getpagesize (),
old_prot, &dummy_prot))
system_printf ("WARNING: VirtualProtect to copy "
"protection to child failed for"
"MAP_PRIVATE address %p, %E",
rec->get_address ());
if (!ret) if (!ret)
{ {
system_printf ("ReadProcessMemory FAILED for " system_printf ("ReadProcessMemory (2nd try) "
"failed for "
"MAP_PRIVATE address %p, %E", "MAP_PRIVATE address %p, %E",
rec->get_address ()); rec->get_address ());
return -1; return -1;