OSDN Git Service

* mmap.cc (fixup_mmaps_after_fork): Copy protection to child process.
authorcorinna <corinna>
Tue, 14 Jan 2003 21:01:42 +0000 (21:01 +0000)
committercorinna <corinna>
Tue, 14 Jan 2003 21:01:42 +0000 (21:01 +0000)
Change ambiguous debug output.

winsup/cygwin/ChangeLog
winsup/cygwin/mmap.cc

index 67ada30..6ad7ed4 100644 (file)
@@ -1,5 +1,10 @@
 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>
+
        * mmap.cc (mmap_record::access): Change argument type to caddr_t
        for strictness.
        (mprotect): Protect against calling VirtualProtect() for shared
index 4b7329c..08da3b8 100644 (file)
@@ -1006,21 +1006,29 @@ fixup_mmaps_after_fork (HANDLE parent)
                          }
                        else
                          {
-                           BOOL ret, ret2;
+                           BOOL ret;
+                           DWORD dummy_prot;
+
                            ret = ReadProcessMemory (parent, address, address,
                                                     getpagesize (), NULL);
-                           ret2 = VirtualProtectEx(parent,
-                                                   address, getpagesize (),
-                                                   old_prot, &old_prot);
-                           if (!ret2)
-                             system_printf ("WARNING: VirtualProtectEx to"
+                           if (!VirtualProtectEx(parent,
+                                                 address, getpagesize (),
+                                                 old_prot, &dummy_prot))
+                             system_printf ("WARNING: VirtualProtectEx to "
                                             "return to previous state "
                                             "in parent failed for "
                                             "MAP_PRIVATE address %p, %E",
                                             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)
                              {
-                               system_printf ("ReadProcessMemory FAILED for "
+                               system_printf ("ReadProcessMemory (2nd try) "
+                                              "failed for "
                                               "MAP_PRIVATE address %p, %E",
                                               rec->get_address ());
                                return -1;