dinput: Explicitly check for -1 as open() failure code.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3b3c0d9e09
commit
3605cde8ea
|
@ -150,8 +150,7 @@ static BOOL read_sys_id_variable(int index, const char *property, WORD *value)
|
|||
BOOL ret = FALSE;
|
||||
|
||||
sprintf(sys_path, SYS_PATH_FORMAT, index, property);
|
||||
sys_fd = open(sys_path, O_RDONLY);
|
||||
if (sys_fd > 0)
|
||||
if ((sys_fd = open(sys_path, O_RDONLY)) != -1)
|
||||
{
|
||||
if (read(sys_fd, id_str, 4) == 4)
|
||||
{
|
||||
|
@ -180,10 +179,10 @@ static INT find_joystick_devices(void)
|
|||
BYTE axes_map[ABS_MAX + 1];
|
||||
|
||||
snprintf(joydev.device, sizeof(joydev.device), "%s%d", JOYDEV_NEW, i);
|
||||
if ((fd = open(joydev.device, O_RDONLY)) < 0)
|
||||
if ((fd = open(joydev.device, O_RDONLY)) == -1)
|
||||
{
|
||||
snprintf(joydev.device, sizeof(joydev.device), "%s%d", JOYDEV_OLD, i);
|
||||
if ((fd = open(joydev.device, O_RDONLY)) < 0) continue;
|
||||
if ((fd = open(joydev.device, O_RDONLY)) == -1) continue;
|
||||
}
|
||||
|
||||
strcpy(joydev.name, "Wine Joystick");
|
||||
|
@ -355,7 +354,7 @@ static HRESULT joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS
|
|||
((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) ||
|
||||
(((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800))) {
|
||||
/* check whether we have a joystick */
|
||||
if ((fd = open(joystick_devices[id].device, O_RDONLY)) < 0)
|
||||
if ((fd = open(joystick_devices[id].device, O_RDONLY)) == -1)
|
||||
{
|
||||
WARN("open(%s, O_RDONLY) failed: %s\n", joystick_devices[id].device, strerror(errno));
|
||||
return S_FALSE;
|
||||
|
@ -384,7 +383,7 @@ static HRESULT joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS
|
|||
((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) ||
|
||||
(((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800))) {
|
||||
/* check whether we have a joystick */
|
||||
if ((fd = open(joystick_devices[id].device, O_RDONLY)) < 0)
|
||||
if ((fd = open(joystick_devices[id].device, O_RDONLY)) == -1)
|
||||
{
|
||||
WARN("open(%s, O_RDONLY) failed: %s\n", joystick_devices[id].device, strerror(errno));
|
||||
return S_FALSE;
|
||||
|
|
Loading…
Reference in New Issue