lkml.org 
[lkml]   [2019]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 3.16 038/132] selftests/ipc: Fix msgque compiler warnings
    3.16.74-rc1 review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Kees Cook <keescook@chromium.org>

    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 <keescook@chromium.org>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
    [bwh: Backported to 3.16: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    tools/testing/selftests/ipc/msgque.c | 11 ++++++-----
    1 file changed, 6 insertions(+), 5 deletions(-)

    --- a/tools/testing/selftests/ipc/msgque.c
    +++ b/tools/testing/selftests/ipc/msgque.c
    @@ -1,8 +1,9 @@
    +#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>

    #define MAX_MSG_SIZE 32
    @@ -70,7 +71,7 @@ int restore_queue(struct msgque_data *ms
    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 msgqu

    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;
    }
    \
     
     \ /
      Last update: 2019-09-20 16:38    [W:4.056 / U:0.404 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site