tools/lib/subcmd/pager.c: do not alias select() params
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Tue, 6 Feb 2018 23:37:52 +0000 (15:37 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 May 2018 22:13:09 +0000 (15:13 -0700)
commit ad343a98e74e85aa91d844310e797f96fee6983b upstream.

Use a separate fd set for select()-s exception fds param to fix the
following gcc warning:

  pager.c:36:12: error: passing argument 2 to restrict-qualified parameter aliases with argument 4 [-Werror=restrict]
    select(1, &in, NULL, &in, NULL);
              ^~~        ~~~

Link: http://lkml.kernel.org/r/20180101105626.7168-1-sergey.senozhatsky@gmail.com
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Fredrik Schön <fredrikschon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/lib/subcmd/pager.c

index 6518bea926d6fdec47be68a73431110e45e9795b..68af60fdf0b922d557ae17b05dc7feb2d7e3631c 100644 (file)
@@ -29,10 +29,13 @@ static void pager_preexec(void)
         * have real input
         */
        fd_set in;
+       fd_set exception;
 
        FD_ZERO(&in);
+       FD_ZERO(&exception);
        FD_SET(0, &in);
-       select(1, &in, NULL, &in, NULL);
+       FD_SET(0, &exception);
+       select(1, &in, NULL, &exception, NULL);
 
        setenv("LESS", "FRSX", 0);
 }