summaryrefslogtreecommitdiff
path: root/src/udev/accelerometer/accelerometer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev/accelerometer/accelerometer.c')
-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) {