about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/mq_unlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/mq_unlink.c')
-rw-r--r--sysdeps/unix/sysv/linux/mq_unlink.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/mq_unlink.c b/sysdeps/unix/sysv/linux/mq_unlink.c
index 8da70ea42b..4344c5d0ef 100644
--- a/sysdeps/unix/sysv/linux/mq_unlink.c
+++ b/sysdeps/unix/sysv/linux/mq_unlink.c
@@ -31,7 +31,15 @@ mq_unlink (const char *name)
       __set_errno (EINVAL);
       return -1;
     }
-  return INLINE_SYSCALL (mq_unlink, 1, name + 1);
+
+  int ret = INLINE_SYSCALL (mq_unlink, 1, name + 1);
+
+  /* While unlink can return either EPERM or EACCES, mq_unlink should
+     return just EACCES.  */
+  if (ret < 0 && errno == EPERM)
+    __set_errno (EACCES);
+
+  return ret;
 }
 
 #else