From 09a33f052190ef4d997c54e012c9466844bdae0e Mon Sep 17 00:00:00 2001 From: Hartmut Knaack Date: Wed, 10 Jun 2015 21:51:19 +0200 Subject: [PATCH] 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 Signed-off-by: Jonathan Cameron --- tools/iio/iio_event_monitor.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); }