summaryrefslogtreecommitdiff
path: root/tools/iio
diff options
context:
space:
mode:
authorHartmut Knaack <knaack.h@gmx.de>2015-06-10 21:51:19 +0200
committerJonathan Cameron <jic23@kernel.org>2015-06-21 16:20:10 +0100
commit09a33f052190ef4d997c54e012c9466844bdae0e (patch)
tree86bc9ed30d845f534b6d2605b488fadb3bc74204 /tools/iio
parentefa86e9fa82eaeee76903f131bc326af48a7cbcf (diff)
tools:iio:iio_event_monitor: check if event is fully read
Check that the read event is of the expected size. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'tools/iio')
-rw-r--r--tools/iio/iio_event_monitor.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
index 1dba09062a64..703f4cb0e8e9 100644
--- a/tools/iio/iio_event_monitor.c
+++ b/tools/iio/iio_event_monitor.c
@@ -310,6 +310,12 @@ int main(int argc, char **argv)
}
}
+ if (ret != sizeof(event)) {
+ printf("Reading event failed!\n");
+ ret = -EIO;
+ break;
+ }
+
print_event(&event);
}