From 08b0831b9437a6f3c6ec5fc2b3f87a7bffbe1203 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Fri, 23 Jan 2015 16:53:41 -0500 Subject: [PATCH] Bug fix: Use inotify_rm_watch() rather than close() to remove the Linux joystick watch. --- src/linux_joystick.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/linux_joystick.c b/src/linux_joystick.c index 5f46519b1..5a9d8e2a2 100644 --- a/src/linux_joystick.c +++ b/src/linux_joystick.c @@ -277,11 +277,13 @@ void _glfwTerminateJoysticks(void) regfree(&_glfw.linux_js.regex); - if (_glfw.linux_js.watch > 0) - close(_glfw.linux_js.watch); - if (_glfw.linux_js.inotify > 0) + { + if (_glfw.linux_js.watch > 0) + inotify_rm_watch(_glfw.linux_js.inotify, _glfw.linux_js.watch); + close(_glfw.linux_js.inotify); + } #endif // __linux__ }