about summary refs log tree commit diff
path: root/rt/tst-shm-cancel.c
diff options
context:
space:
mode:
Diffstat (limited to 'rt/tst-shm-cancel.c')
-rw-r--r--rt/tst-shm-cancel.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/rt/tst-shm-cancel.c b/rt/tst-shm-cancel.c
index e787229ab2..67d8ce86d5 100644
--- a/rt/tst-shm-cancel.c
+++ b/rt/tst-shm-cancel.c
@@ -26,7 +26,14 @@
 #include <stdlib.h>
 
 static sem_t sem;	/* Use to sync with thread start.  */
-static const char shm_name[] = "/glibc-shm_open-cancel";
+static char shm_name[sizeof "/glibc-shm_open-cancel-" + sizeof (pid_t) * 3];
+
+static void
+init_shm_name (void)
+{
+  snprintf (shm_name, sizeof (shm_name), "/glibc-shm_open-cancel-%u",
+	    getpid ());
+}
 
 static void
 remove_shm (int status, void *arg)
@@ -86,6 +93,8 @@ do_test (void)
 {
   pthread_t td;
 
+  init_shm_name ();
+
   if (sem_init (&sem, 0, 0))
     {
       printf ("error: sem_init failed: %m\n");