From d8c83adc04c2a7c13dd9a562189e049ea4c11a56 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 2 Jan 2005 00:34:55 +0000 Subject: * shared.cc (open_shared): Don't attempt VirtualAlloc magic if first attempt to map memory fails. --- winsup/cygwin/shared.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/shared.cc') 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; -- cgit v1.2.3