* pthread.cc (mangle_sem_name): Use cygheap->shared_prefix instead

of fiddling with wincap.has_terminal_services manually.
This commit is contained in:
Corinna Vinschen 2005-09-27 20:34:19 +00:00
parent f1cdab8563
commit 22704a8da3
2 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2005-09-27 Corinna Vinschen <corinna@vinschen.de>
* pthread.cc (mangle_sem_name): Use cygheap->shared_prefix instead
of fiddling with wincap.has_terminal_services manually.
2005-09-27 Corinna Vinschen <corinna@vinschen.de>
* cygheap.cc (cygheap_init): Add GLOBAL_PRIV to hProcToken explicitely

View File

@ -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 <stdarg.h>
#include <sys/fcntl.h>
#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++;