[PATCH 3.16 362/366] tools/lib/subcmd/pager.c: do not alias select() params

From: Ben Hutchings
Date: Sun Nov 11 2018 - 15:30:42 EST


3.16.61-rc1 review patch. If anyone has any objections, please let me know.

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

From: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>

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@xxxxxxxxx
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
tools/perf/util/pager.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

--- a/tools/perf/util/pager.c
+++ b/tools/perf/util/pager.c
@@ -16,10 +16,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);
}