summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-02-01 13:45:46 +0100
committerRémi Verschelde <remi@verschelde.fr>2016-02-01 13:45:46 +0100
commit519c8667032225d2c987562a716c7a2629198772 (patch)
tree2f686a61a796012f28608bf37208857f507d22cb
parentd3bd1a731c0c1d06abe15e5eea5de64453008b28 (diff)
parent2809b31f8c7b87a020d2c8f4750d3652176b936d (diff)
Merge pull request #3536 from Hinsbart/close
close file descriptor if ioctls failed
-rw-r--r--platform/x11/joystick_linux.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/platform/x11/joystick_linux.cpp b/platform/x11/joystick_linux.cpp
index 5007976f0d..208bb2a2b7 100644
--- a/platform/x11/joystick_linux.cpp
+++ b/platform/x11/joystick_linux.cpp
@@ -304,6 +304,7 @@ void joystick_linux::open_joystick(const char *p_path) {
if ((ioctl(fd, EVIOCGBIT(0, sizeof(evbit)), evbit) < 0) ||
(ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit) < 0) ||
(ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbit)), absbit) < 0)) {
+ close(fd);
return;
}