A couple of fixes in fg_joystick_x11.c identified in bug report #249
authorJohn Tsiombikas <nuclear@member.fsf.org>
Wed, 11 Sep 2019 13:24:28 +0000 (13:24 +0000)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Wed, 11 Sep 2019 13:24:28 +0000 (13:24 +0000)
commit85fe5ac7b6efe580eab22820aa740a4b2dcafb0c
treec86737642b43a80c25763505e158e1cabd2e45db
parent0c5339dad42bcdda8cc4c86b16194f7267578cd2
A couple of fixes in fg_joystick_x11.c identified in bug report #249
- The correct way to set the O_NONBLOCK flag, is to OR that flag with existing
  flags. Previously we were overriding everything else and setting the flags
  value to O_NONBLOCK directly. Unlikely to cause a problem because we probably
  don't have any other flags in the newly opened file descriptor, but strictly
  spaking it was incorrect.
- If ioctl JSIOCGAXES and JSIOCGBUTTONS could fail, as it stands, it would
  clobber the value of joy->num_axes/joy->num_buttons. It can't fail, but maybe
  in the future who knows. Let's be safe.

git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1848 7f0cb862-5218-0410-a997-914c9d46530a
src/x11/fg_joystick_x11.c