Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3605cde8
Commit
3605cde8
authored
Aug 23, 2016
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 23, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
>
parent
3b3c0d9e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
joystick_linux.c
dlls/dinput/joystick_linux.c
+5
-6
No files found.
dlls/dinput/joystick_linux.c
View file @
3605cde8
...
@@ -150,8 +150,7 @@ static BOOL read_sys_id_variable(int index, const char *property, WORD *value)
...
@@ -150,8 +150,7 @@ static BOOL read_sys_id_variable(int index, const char *property, WORD *value)
BOOL
ret
=
FALSE
;
BOOL
ret
=
FALSE
;
sprintf
(
sys_path
,
SYS_PATH_FORMAT
,
index
,
property
);
sprintf
(
sys_path
,
SYS_PATH_FORMAT
,
index
,
property
);
sys_fd
=
open
(
sys_path
,
O_RDONLY
);
if
((
sys_fd
=
open
(
sys_path
,
O_RDONLY
))
!=
-
1
)
if
(
sys_fd
>
0
)
{
{
if
(
read
(
sys_fd
,
id_str
,
4
)
==
4
)
if
(
read
(
sys_fd
,
id_str
,
4
)
==
4
)
{
{
...
@@ -180,10 +179,10 @@ static INT find_joystick_devices(void)
...
@@ -180,10 +179,10 @@ static INT find_joystick_devices(void)
BYTE
axes_map
[
ABS_MAX
+
1
];
BYTE
axes_map
[
ABS_MAX
+
1
];
snprintf
(
joydev
.
device
,
sizeof
(
joydev
.
device
),
"%s%d"
,
JOYDEV_NEW
,
i
);
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
);
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"
);
strcpy
(
joydev
.
name
,
"Wine Joystick"
);
...
@@ -355,7 +354,7 @@ static HRESULT joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS
...
@@ -355,7 +354,7 @@ static HRESULT joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS
((
dwDevType
==
DIDEVTYPE_JOYSTICK
)
&&
(
version
>
0x0300
&&
version
<
0x0800
))
||
((
dwDevType
==
DIDEVTYPE_JOYSTICK
)
&&
(
version
>
0x0300
&&
version
<
0x0800
))
||
(((
dwDevType
==
DI8DEVCLASS_GAMECTRL
)
||
(
dwDevType
==
DI8DEVTYPE_JOYSTICK
))
&&
(
version
>=
0x0800
)))
{
(((
dwDevType
==
DI8DEVCLASS_GAMECTRL
)
||
(
dwDevType
==
DI8DEVTYPE_JOYSTICK
))
&&
(
version
>=
0x0800
)))
{
/* check whether we have a joystick */
/* 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
));
WARN
(
"open(%s, O_RDONLY) failed: %s
\n
"
,
joystick_devices
[
id
].
device
,
strerror
(
errno
));
return
S_FALSE
;
return
S_FALSE
;
...
@@ -384,7 +383,7 @@ static HRESULT joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS
...
@@ -384,7 +383,7 @@ static HRESULT joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS
((
dwDevType
==
DIDEVTYPE_JOYSTICK
)
&&
(
version
>
0x0300
&&
version
<
0x0800
))
||
((
dwDevType
==
DIDEVTYPE_JOYSTICK
)
&&
(
version
>
0x0300
&&
version
<
0x0800
))
||
(((
dwDevType
==
DI8DEVCLASS_GAMECTRL
)
||
(
dwDevType
==
DI8DEVTYPE_JOYSTICK
))
&&
(
version
>=
0x0800
)))
{
(((
dwDevType
==
DI8DEVCLASS_GAMECTRL
)
||
(
dwDevType
==
DI8DEVTYPE_JOYSTICK
))
&&
(
version
>=
0x0800
)))
{
/* check whether we have a joystick */
/* 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
));
WARN
(
"open(%s, O_RDONLY) failed: %s
\n
"
,
joystick_devices
[
id
].
device
,
strerror
(
errno
));
return
S_FALSE
;
return
S_FALSE
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment