From d8c83adc04c2a7c13dd9a562189e049ea4c11a56 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 2 Jan 2005 00:34:55 +0000 Subject: [PATCH] * shared.cc (open_shared): Don't attempt VirtualAlloc magic if first attempt to map memory fails. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/shared.cc | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index ab702dbb7..26d3a3591 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2005-01-01 Christopher Faylor + + * shared.cc (open_shared): Don't attempt VirtualAlloc magic if first + attempt to map memory fails. + 2004-12-30 Christopher Faylor * devices.cc (device::isfs): Return true for the logical case of diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index b276f92f9..0e7ae1baa 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -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;