OSDN Git Service

* shared.cc (open_shared): Don't attempt VirtualAlloc magic if first attempt to
authorcgf <cgf>
Sun, 2 Jan 2005 00:34:55 +0000 (00:34 +0000)
committercgf <cgf>
Sun, 2 Jan 2005 00:34:55 +0000 (00:34 +0000)
map memory fails.

winsup/cygwin/ChangeLog
winsup/cygwin/shared.cc

index ab702db..26d3a35 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-01  Christopher Faylor  <cgf@timesys.com>
+
+       * shared.cc (open_shared): Don't attempt VirtualAlloc magic if first
+       attempt to map memory fails.
+
 2004-12-30  Christopher Faylor  <cgf@timesys.com>
 
        * devices.cc (device::isfs): Return true for the logical case of
index b276f92..0e7ae1b 100644 (file)
@@ -79,7 +79,7 @@ open_shared (const char *name, int n, HANDLE &shared_h, DWORD size,
   void *shared;
 
   void *addr;
-  if (!wincap.needs_memory_protection ())
+  if (!wincap.needs_memory_protection () && offsets[0])
     addr = NULL;
   else
     {
@@ -116,12 +116,13 @@ open_shared (const char *name, int n, HANDLE &shared_h, DWORD size,
       if (wincap.is_winnt ())
        system_printf ("relocating shared object %s(%d) from %p to %p on Windows NT", name, n, addr, shared);
 #endif
+      offsets[0] = NULL;
     }
 
   if (!shared)
     api_fatal ("MapViewOfFileEx '%s'(%p), %E.  Terminating.", name, shared_h);
 
-  if (m == SH_CYGWIN_SHARED && wincap.needs_memory_protection ())
+  if (m == SH_CYGWIN_SHARED && offsets[0] && wincap.needs_memory_protection ())
     {
       unsigned delta = (char *) shared - offsets[0];
       offsets[0] = (char *) shared;