Commit a92bef0f authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Ingo Molnar

perf stat: Handle pipe read failures in perf stat

Building builtin-stat.c reports the following errors:

cc1: warnings being treated as errors
builtin-stat.c: In function ‘run_perf_stat’:
builtin-stat.c:242: erreur: ignoring return value of ‘read’, declared with attribute warn_unused_result
builtin-stat.c:255: erreur: ignoring return value of ‘read’, declared with attribute warn_unused_result
make: *** [builtin-stat.o] Erreur 1

This patch handles the possible pipe read failures.
Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Anton Blanchard <anton@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <1246474930-6088-2-git-send-email-fweisbec@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 0406ca6d
...@@ -239,7 +239,8 @@ static int run_perf_stat(int argc __used, const char **argv) ...@@ -239,7 +239,8 @@ static int run_perf_stat(int argc __used, const char **argv)
/* /*
* Wait until the parent tells us to go. * Wait until the parent tells us to go.
*/ */
read(go_pipe[0], &buf, 1); if (read(go_pipe[0], &buf, 1) == -1)
perror("unable to read pipe");
execvp(argv[0], (char **)argv); execvp(argv[0], (char **)argv);
...@@ -252,7 +253,8 @@ static int run_perf_stat(int argc __used, const char **argv) ...@@ -252,7 +253,8 @@ static int run_perf_stat(int argc __used, const char **argv)
*/ */
close(child_ready_pipe[1]); close(child_ready_pipe[1]);
close(go_pipe[0]); close(go_pipe[0]);
read(child_ready_pipe[0], &buf, 1); if (read(child_ready_pipe[0], &buf, 1) == -1)
perror("unable to read pipe");
close(child_ready_pipe[0]); close(child_ready_pipe[0]);
for (counter = 0; counter < nr_counters; counter++) for (counter = 0; counter < nr_counters; counter++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment