]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/posix/shm_unlink.c
linux: Require /dev/shm as the shared memory file system
[thirdparty/glibc.git] / sysdeps / posix / shm_unlink.c
index f3258a0f5aedde3353a1e275d24e72c48fcbbd15..c90b854c78b5c0cbf11170c9984cdb7269d012f4 100644 (file)
 
 #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;