From 22704a8da39db692d8c3c65f3d636d247984f85b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 27 Sep 2005 20:34:19 +0000 Subject: [PATCH] * pthread.cc (mangle_sem_name): Use cygheap->shared_prefix instead of fiddling with wincap.has_terminal_services manually. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/pthread.cc | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index fca90f7b2..f54b62ec7 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2005-09-27 Corinna Vinschen + + * pthread.cc (mangle_sem_name): Use cygheap->shared_prefix instead + of fiddling with wincap.has_terminal_services manually. + 2005-09-27 Corinna Vinschen * cygheap.cc (cygheap_init): Add GLOBAL_PRIV to hProcToken explicitely diff --git a/winsup/cygwin/pthread.cc b/winsup/cygwin/pthread.cc index 956d70a42..949bc0970 100644 --- a/winsup/cygwin/pthread.cc +++ b/winsup/cygwin/pthread.cc @@ -13,6 +13,10 @@ #include "winsup.h" #include "thread.h" #include "cygerrno.h" +#include "path.h" +#include "fhandler.h" +#include "dtable.h" +#include "cygheap.h" #include #include #include "cygtls.h" @@ -174,15 +178,14 @@ mangle_sem_name (char *mangled, const char *name) set_errno (ENOENT); return false; } - int len = strlen (name); - if (len >= CYG_MAX_PATH - || (wincap.has_terminal_services () && len >= CYG_MAX_PATH - 7)) + size_t len = strlen (cygheap->shared_prefix); + if (strlen (name) >= CYG_MAX_PATH - len) { set_errno (EINVAL); return false; } - strcpy (mangled, wincap.has_terminal_services () ? "Global\\" : ""); - char *d = mangled + strlen (mangled); + strcpy (mangled, cygheap->shared_prefix); + char *d = mangled + len; const char *s = name; while (*s) *d++ = (*s == '\\') ? '/' : *s++;