Accept >= 0 return values of the ioctl() to figure out the device name.

2004-11-24  Simon Budig  <simon@gimp.org>

	* modules/controller_linux_input.c: Accept >= 0 return values of the
	ioctl() to figure out the device name. Apparently it is the number of
	bytes written to the string, so we might omit the strlen() following,
	but I don't like to rely on that...
This commit is contained in:
Simon Budig
2004-11-24 14:25:58 +00:00
committed by Simon Budig
parent cfcb716d51
commit b349746fc2
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2004-11-24 Simon Budig <simon@gimp.org>
* modules/controller_linux_input.c: Accept >= 0 return values of the
ioctl() to figure out the device name. Apparently it is the number of
bytes written to the string, so we might omit the strlen() following,
but I don't like to rely on that...
2004-11-24 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpcontroller.[ch]: guarded the whole header

View File

@ -361,7 +361,7 @@ linux_input_set_device (ControllerLinuxInput *controller,
gchar name[256];
name[0] = '\0';
if (ioctl (fd, EVIOCGNAME (sizeof (name)), name) == 0 &&
if (ioctl (fd, EVIOCGNAME (sizeof (name)), name) >= 0 &&
strlen (name) > 0 &&
g_utf8_validate (name, -1, NULL))
{