summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/iio/iio_event_monitor.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
index 1374374208ee..1316527f3c3c 100644
--- a/tools/iio/iio_event_monitor.c
+++ b/tools/iio/iio_event_monitor.c
@@ -286,7 +286,10 @@ int main(int argc, char **argv)
goto error_free_chrdev_name;
}
- close(fd);
+ if (close(fd) == -1) {
+ ret = -errno;
+ goto error_free_chrdev_name;
+ }
while (true) {
ret = read(event_fd, &event, sizeof(event));
@@ -304,7 +307,9 @@ int main(int argc, char **argv)
print_event(&event);
}
- close(event_fd);
+ if (close(event_fd) == -1)
+ perror("Failed to close event file");
+
error_free_chrdev_name:
free(chrdev_name);
error_ret: