Musl and glibc syscall wrappers handles the null mq name in different ways and report different errors. Glibc reports error if the mq_name is not preceded by "/" character but musl does not treat this as an error.
Avoid the syscall wrapper by calling the syscall directly. This needs skipping the leading "/" character in mq_name as expected by the kernel.
Signed-off-by: Amit Daniel Kachhap amit.kachhap@arm.com --- Changes in v3: * Updated commit messages for musl and glibc as pointed by Beata.
testcases/kernel/syscalls/mq_open/mq_open01.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/syscalls/mq_open/mq_open01.c b/testcases/kernel/syscalls/mq_open/mq_open01.c index cd2a229d8..06858991e 100644 --- a/testcases/kernel/syscalls/mq_open/mq_open01.c +++ b/testcases/kernel/syscalls/mq_open/mq_open01.c @@ -14,6 +14,7 @@ #include "tst_test.h" #include "tst_safe_file_ops.h" #include "tst_safe_posix_ipc.h" +#include "lapi/syscalls.h"
#define QUEUE_NAME "/test_mqueue" #define QUEUE_INIT "/init_mqueue" @@ -95,7 +96,7 @@ static struct test_case tcase[] = { .qname = "", .oflag = O_CREAT, .ret = -1, - .err = EINVAL, + .err = ENOENT, }, { .desc = "NORMAL", @@ -228,7 +229,10 @@ static void do_test(unsigned int i) if (tc->setup) tc->setup();
- TEST(fd = mq_open(qname, tc->oflag, S_IRWXU, tc->rq)); + if (*qname == '/') + TEST(fd = tst_syscall(__NR_mq_open, qname + 1, tc->oflag, S_IRWXU, tc->rq)); + else + TEST(fd = tst_syscall(__NR_mq_open, qname, tc->oflag, S_IRWXU, tc->rq));
if (fd > 0 && tc->rq) { if (mq_getattr(fd, &oldattr) < 0) {