mirror of git://git.musl-libc.org/musl
mq names without leading / have impl-def behavior; allowing them is easier
This commit is contained in:
parent
2b0cedac8d
commit
e1d2a8e239
|
@ -1,6 +1,5 @@
|
||||||
#include <mqueue.h>
|
#include <mqueue.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
|
|
||||||
|
@ -8,10 +7,7 @@ mqd_t mq_open(const char *name, int flags, ...)
|
||||||
{
|
{
|
||||||
mode_t mode = 0;
|
mode_t mode = 0;
|
||||||
struct mq_attr *attr = 0;
|
struct mq_attr *attr = 0;
|
||||||
if (*name++ != '/') {
|
if (*name == '/') name++;
|
||||||
errno = EINVAL;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (flags & O_CREAT) {
|
if (flags & O_CREAT) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, flags);
|
va_start(ap, flags);
|
||||||
|
|
|
@ -5,10 +5,7 @@
|
||||||
int mq_unlink(const char *name)
|
int mq_unlink(const char *name)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
if (*name++ != '/') {
|
if (*name == '/') name++;
|
||||||
errno = EINVAL;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
ret = __syscall(SYS_mq_unlink, name);
|
ret = __syscall(SYS_mq_unlink, name);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (ret == -EPERM) ret = -EACCES;
|
if (ret == -EPERM) ret = -EACCES;
|
||||||
|
|
Loading…
Reference in New Issue