summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/accelerometer/accelerometer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/udev/accelerometer/accelerometer.c b/src/udev/accelerometer/accelerometer.c
index b8ed7b8edd..67fed27c5e 100644
--- a/src/udev/accelerometer/accelerometer.c
+++ b/src/udev/accelerometer/accelerometer.c
@@ -205,8 +205,10 @@ static void test_orientation(struct udev *udev,
r = read(fd, ev, sizeof(struct input_event) * 64);
- if (r < (int) sizeof(struct input_event))
+ if (r < (int) sizeof(struct input_event)) {
+ close(fd);
return;
+ }
for (i = 0; i < r / (int) sizeof(struct input_event); i++) {
if (got_syn == 1) {