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:
@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user