[PATCH] perfcounter: fix unhandled io return value

From: Frederic Weisbecker
Date: Thu Jun 25 2009 - 16:21:40 EST


Building latest perfcounter fails on the following error:

cc1: warnings being treated as errors
builtin-record.c: In function âcreate_counterâ:
builtin-record.c:451: erreur: ignoring return value of âreadâ, declared with attribute warn_unused_result
make: *** [builtin-record.o] Erreur 1

Just check if we successfully read the perf file descriptor.

Signed-off-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>
---
tools/perf/builtin-record.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 798a56d..d18546f 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -448,7 +448,10 @@ try_again:
}
}

- read(fd[nr_cpu][counter], &read_data, sizeof(read_data));
+ if (read(fd[nr_cpu][counter], &read_data, sizeof(read_data)) == -1) {
+ perror("Unable to read perf file descriptor\n");
+ exit(-1);
+ }

perf_header_attr__add_id(h_attr, read_data.id);

--
1.6.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/