Skip to content

Commit a147faa

Browse files
keesshuahkh
authored andcommitted
selftests/ipc: Fix msgque compiler warnings
This fixes the various compiler warnings when building the msgque selftest. The primary change is using sys/msg.h instead of linux/msg.h directly to gain the API declarations. Fixes: 3a66553 ("selftests: IPC message queue copy feature test") Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent dff6d2a commit a147faa

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tools/testing/selftests/ipc/msgque.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// SPDX-License-Identifier: GPL-2.0
2+
#define _GNU_SOURCE
23
#include <stdlib.h>
34
#include <stdio.h>
45
#include <string.h>
56
#include <errno.h>
6-
#include <linux/msg.h>
7+
#include <sys/msg.h>
78
#include <fcntl.h>
89

910
#include "../kselftest.h"
@@ -73,7 +74,7 @@ int restore_queue(struct msgque_data *msgque)
7374
return 0;
7475

7576
destroy:
76-
if (msgctl(id, IPC_RMID, 0))
77+
if (msgctl(id, IPC_RMID, NULL))
7778
printf("Failed to destroy queue: %d\n", -errno);
7879
return ret;
7980
}
@@ -120,7 +121,7 @@ int check_and_destroy_queue(struct msgque_data *msgque)
120121

121122
ret = 0;
122123
err:
123-
if (msgctl(msgque->msq_id, IPC_RMID, 0)) {
124+
if (msgctl(msgque->msq_id, IPC_RMID, NULL)) {
124125
printf("Failed to destroy queue: %d\n", -errno);
125126
return -errno;
126127
}
@@ -129,7 +130,7 @@ int check_and_destroy_queue(struct msgque_data *msgque)
129130

130131
int dump_queue(struct msgque_data *msgque)
131132
{
132-
struct msqid64_ds ds;
133+
struct msqid_ds ds;
133134
int kern_id;
134135
int i, ret;
135136

@@ -245,7 +246,7 @@ int main(int argc, char **argv)
245246
return ksft_exit_pass();
246247

247248
err_destroy:
248-
if (msgctl(msgque.msq_id, IPC_RMID, 0)) {
249+
if (msgctl(msgque.msq_id, IPC_RMID, NULL)) {
249250
printf("Failed to destroy queue: %d\n", -errno);
250251
return ksft_exit_fail();
251252
}

0 commit comments

Comments
 (0)