Skip to content

Commit

Permalink
selftests/ipc: Fix msgque compiler warnings
Browse files Browse the repository at this point in the history
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 <keescook@chromium.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
  • Loading branch information
Kees Cook authored and Shuah Khan committed Apr 19, 2019
1 parent dff6d2a commit a147faa
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tools/testing/selftests/ipc/msgque.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// SPDX-License-Identifier: GPL-2.0
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <linux/msg.h>
#include <sys/msg.h>
#include <fcntl.h>

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

destroy:
if (msgctl(id, IPC_RMID, 0))
if (msgctl(id, IPC_RMID, NULL))
printf("Failed to destroy queue: %d\n", -errno);
return ret;
}
Expand Down Expand Up @@ -120,7 +121,7 @@ int check_and_destroy_queue(struct msgque_data *msgque)

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

int dump_queue(struct msgque_data *msgque)
{
struct msqid64_ds ds;
struct msqid_ds ds;
int kern_id;
int i, ret;

Expand Down Expand Up @@ -245,7 +246,7 @@ int main(int argc, char **argv)
return ksft_exit_pass();

err_destroy:
if (msgctl(msgque.msq_id, IPC_RMID, 0)) {
if (msgctl(msgque.msq_id, IPC_RMID, NULL)) {
printf("Failed to destroy queue: %d\n", -errno);
return ksft_exit_fail();
}
Expand Down

0 comments on commit a147faa

Please sign in to comment.