Gcc complains about:
lib/perf-counter.c:43:13: error: ignoring return value of 'read',
declared with attribute warn_unused_result [-Werror=unused-result]
read(fd__, counter, sizeof(*counter));
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
uint64_t
perf_counter_read(uint64_t *counter)
{
- if (fd__ > 0) {
- read(fd__, counter, sizeof(*counter));
- } else {
+ size_t size = sizeof *counter;
+
+ if (fd__ <= 0 || read(fd__, counter, size) < size) {
*counter = 0;
}