mq names without leading / have impl-def behavior; allowing them is easier
authorRich Felker <dalias@aerifal.cx>
Tue, 7 Jun 2011 19:07:54 +0000 (15:07 -0400)
committerRich Felker <dalias@aerifal.cx>
Tue, 7 Jun 2011 19:07:54 +0000 (15:07 -0400)
src/mq/mq_open.c
src/mq/mq_unlink.c

index 57220a2..aa91d58 100644 (file)
@@ -1,6 +1,5 @@
 #include <mqueue.h>
 #include <fcntl.h>
 #include <mqueue.h>
 #include <fcntl.h>
-#include <errno.h>
 #include <stdarg.h>
 #include "syscall.h"
 
 #include <stdarg.h>
 #include "syscall.h"
 
@@ -8,10 +7,7 @@ mqd_t mq_open(const char *name, int flags, ...)
 {
        mode_t mode = 0;
        struct mq_attr *attr = 0;
 {
        mode_t mode = 0;
        struct mq_attr *attr = 0;
-       if (*name++ != '/') {
-               errno = EINVAL;
-               return -1;
-       }
+       if (*name == '/') name++;
        if (flags & O_CREAT) {
                va_list ap;
                va_start(ap, flags);
        if (flags & O_CREAT) {
                va_list ap;
                va_start(ap, flags);
index 1bb92af..6a08a4c 100644 (file)
@@ -5,10 +5,7 @@
 int mq_unlink(const char *name)
 {
        int ret;
 int mq_unlink(const char *name)
 {
        int ret;
-       if (*name++ != '/') {
-               errno = EINVAL;
-               return -1;
-       }
+       if (*name == '/') name++;
        ret = __syscall(SYS_mq_unlink, name);
        if (ret < 0) {
                if (ret == -EPERM) ret = -EACCES;
        ret = __syscall(SYS_mq_unlink, name);
        if (ret < 0) {
                if (ret == -EPERM) ret = -EACCES;