Author: jackburton Date: 2011-03-10 09:21:44 +0100 (Thu, 10 Mar 2011) New Revision: 40900 Changeset: http://dev.haiku-os.org/changeset/40900 Modified: haiku/trunk/src/kits/device/Joystick.cpp Log: Initialize ffd to -1 in the constructor otherwise many checks may fail afterwards, and BJoystick won't work. Also reset it to -1 in the destructor for symmetry. Found by Carwyn Jones. Thanks! Modified: haiku/trunk/src/kits/device/Joystick.cpp =================================================================== --- haiku/trunk/src/kits/device/Joystick.cpp 2011-03-10 07:58:55 UTC (rev 40899) +++ haiku/trunk/src/kits/device/Joystick.cpp 2011-03-10 08:21:44 UTC (rev 40900) @@ -49,6 +49,7 @@ BJoystick::BJoystick() : fBeBoxMode(false), + ffd(-1), fDevices(new BList), fJoystickInfo(new _joystick_info()) { @@ -61,8 +62,10 @@ BJoystick::~BJoystick() { - if (ffd >= 0) + if (ffd >= 0) { close(ffd); + ffd = -1; + } for (int32 count = fDevices->CountItems() - 1; count >= 0; count--) { free(fDevices->RemoveItem(count)); @@ -132,17 +135,18 @@ BJoystick::Close(void) { CALLED(); - if (ffd >= 0) + if (ffd >= 0) { close(ffd); - ffd = -1; + ffd = -1; + } } void -BJoystick::ScanDevices(bool use_disabled) +BJoystick::ScanDevices(bool useDisabled) { CALLED(); - if (use_disabled) { + if (useDisabled) { _BJoystickTweaker temp(*this); temp.scan_including_disabled(); } @@ -228,6 +232,7 @@ return fJoystickInfo->num_buttons; } + status_t BJoystick::GetControllerModule(BString *out_name) {