diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index f58ed1ed9..fca90f7b2 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2005-09-27 Corinna Vinschen + + * cygheap.cc (cygheap_init): Add GLOBAL_PRIV to hProcToken explicitely + since hProcImpToken isn't initialized here. + * shared.cc (open_shared): Always print mapname instead of name in + debug output. + 2005-09-27 Christopher Faylor * strace.cc (strace::vsprntf): Avoid printing a zero pid. diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc index 6cbdf6ef7..d7d15667c 100644 --- a/winsup/cygwin/cygheap.cc +++ b/winsup/cygwin/cygheap.cc @@ -170,7 +170,7 @@ cygheap_init () if (!cygheap->shared_prefix) cygheap->shared_prefix = cstrdup ( wincap.has_terminal_services () - && (set_process_privilege (SE_CREATE_GLOBAL_PRIV, true) >= 0 + && (set_privilege (hProcToken, SE_CREATE_GLOBAL_PRIV, true) >= 0 || GetLastError () == ERROR_NO_SUCH_PRIVILEGE) ? "Global\\" : ""); } diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index 02c512f17..c491708e3 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -89,15 +89,14 @@ open_shared (const char *name, int n, HANDLE& shared_h, DWORD size, VirtualFree (addr, 0, MEM_RELEASE); } + char map_buf[CYG_MAX_PATH]; + char *mapname = NULL; + if (shared_h) m = SH_JUSTOPEN; else { - char *mapname; - char map_buf[CYG_MAX_PATH]; - if (!name) - mapname = NULL; - else + if (name) mapname = shared_name (map_buf, name, n); if (m == SH_JUSTOPEN) shared_h = OpenFileMapping (access, FALSE, mapname); @@ -133,7 +132,7 @@ open_shared (const char *name, int n, HANDLE& shared_h, DWORD size, } if (!shared) - api_fatal ("MapViewOfFileEx '%s'(%p), %E. Terminating.", name, shared_h); + api_fatal ("MapViewOfFileEx '%s'(%p), %E. Terminating.", mapname, shared_h); if (m == SH_CYGWIN_SHARED && offsets[0] && wincap.needs_memory_protection ()) { @@ -155,7 +154,7 @@ open_shared (const char *name, int n, HANDLE& shared_h, DWORD size, #endif } - debug_printf ("name %s, n %d, shared %p (wanted %p), h %p", name, n, shared, addr, shared_h); + debug_printf ("name %s, n %d, shared %p (wanted %p), h %p", mapname, n, shared, addr, shared_h); return shared; }