(udev) Avoid warning with helgrind - input descriptor -1 is invalid

This commit is contained in:
twinaphex 2017-06-05 05:18:38 +02:00
parent d903b1cc60
commit c3c772a79a

View File

@ -774,12 +774,15 @@ static bool open_devices(udev_input_t *udev,
{
int fd = open(devnode, O_RDONLY | O_NONBLOCK);
RARCH_LOG("[udev] Adding device %s as type %s.\n",
devnode, type_str);
if (!udev_input_add_device(udev, type, devnode, cb))
RARCH_ERR("[udev] Failed to open device: %s (%s).\n",
devnode, strerror(errno));
close(fd);
if (fd != -1)
{
RARCH_LOG("[udev] Adding device %s as type %s.\n",
devnode, type_str);
if (!udev_input_add_device(udev, type, devnode, cb))
RARCH_ERR("[udev] Failed to open device: %s (%s).\n",
devnode, strerror(errno));
close(fd);
}
}
udev_device_unref(dev);