From: Kees Cook Date: Mon, 8 Apr 2019 17:13:44 +0000 (-0700) Subject: selftests/ipc: Fix msgque compiler warnings X-Git-Tag: v3.16.74~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a43eca8aa889570f24bf48f87a719000726d6858;p=thirdparty%2Fkernel%2Fstable.git selftests/ipc: Fix msgque compiler warnings commit a147faa96f832f76e772b1e448e94ea84c774081 upstream. 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: 3a665531a3b7 ("selftests: IPC message queue copy feature test") Signed-off-by: Kees Cook Signed-off-by: Shuah Khan [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c index 552f0810bffb6..330e896c55b0c 100644 --- a/tools/testing/selftests/ipc/msgque.c +++ b/tools/testing/selftests/ipc/msgque.c @@ -1,8 +1,9 @@ +#define _GNU_SOURCE #include #include #include #include -#include +#include #include #define MAX_MSG_SIZE 32 @@ -70,7 +71,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; } @@ -117,7 +118,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; } @@ -126,7 +127,7 @@ err: int dump_queue(struct msgque_data *msgque) { - struct msqid64_ds ds; + struct msqid_ds ds; int kern_id; int i, ret; @@ -243,7 +244,7 @@ int main(int argc, char **argv) return 0; 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 -errno; }