summary refs log tree commit diff
path: root/sysdeps/posix/shm_unlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/posix/shm_unlink.c')
-rw-r--r--sysdeps/posix/shm_unlink.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sysdeps/posix/shm_unlink.c b/sysdeps/posix/shm_unlink.c
index f3258a0f5a..c90b854c78 100644
--- a/sysdeps/posix/shm_unlink.c
+++ b/sysdeps/posix/shm_unlink.c
@@ -25,16 +25,21 @@
 
 #include <errno.h>
 #include <string.h>
-#include "shm-directory.h"
+#include <shm-directory.h>
 
 
 /* Remove shared memory object.  */
 int
 shm_unlink (const char *name)
 {
-  SHM_GET_NAME (ENOENT, -1, "");
-
-  int result = unlink (shm_name);
+  struct shmdir_name dirname;
+  if (__shm_get_name (&dirname, name, false) != 0)
+    {
+      __set_errno (ENOENT);
+      return -1;
+    }
+
+  int result = unlink (dirname.name);
   if (result < 0 && errno == EPERM)
     __set_errno (EACCES);
   return result;