diff --git a/src/arch/InputHandler/InputHandler_Linux_Joystick.cpp b/src/arch/InputHandler/InputHandler_Linux_Joystick.cpp index d61c2082eb..38728d11dc 100644 --- a/src/arch/InputHandler/InputHandler_Linux_Joystick.cpp +++ b/src/arch/InputHandler/InputHandler_Linux_Joystick.cpp @@ -140,6 +140,15 @@ void InputHandler_Linux_Joystick::InputThread() js_event event; int ret = read(fds[i], &event, sizeof(event)); + + if(ret == -1) + { + LOG->Warn("Error reading from joystick %i: %s; disabled", i, strerror(errno)); + close(fds[i]); + fds[i] = -1; + continue; + } + if(ret != sizeof(event)) { LOG->Warn("Unexpected packet (size %i != %i) from joystick %i; disabled", ret, (int)sizeof(event), i);