summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHartmut Knaack <knaack.h@gmx.de>2015-06-10 22:51:19 +0300
committerJonathan Cameron <jic23@kernel.org>2015-06-21 18:20:10 +0300
commit09a33f052190ef4d997c54e012c9466844bdae0e (patch)
tree86bc9ed30d845f534b6d2605b488fadb3bc74204
parentefa86e9fa82eaeee76903f131bc326af48a7cbcf (diff)
downloadlinux-09a33f052190ef4d997c54e012c9466844bdae0e.tar.xz
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>
-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);
}