From a179f491fd06ff59cdab6348fdeeea3666f5eb8e Mon Sep 17 00:00:00 2001 From: Vitaliy Margolen Date: Sat, 27 Dec 2008 11:23:13 -0700 Subject: [PATCH] dinput: Warn if failed to open device. --- dlls/dinput/joystick_linuxinput.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 95666e8df46..c6f07ac3683 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -231,12 +231,17 @@ static void find_joydevs(void) snprintf(buf, sizeof(buf), EVDEVPREFIX"%d", i); - if ((fd=open(buf, O_RDWR))==-1) { - fd = open(buf, O_RDONLY); - no_ff_check = 1; - } + if ((fd = open(buf, O_RDWR)) == -1) + { + fd = open(buf, O_RDONLY); + no_ff_check = 1; + } - if (fd!=-1) { + if (fd == -1) + { + WARN("Failed to open \"%s\": %d %s\n", buf, errno, strerror(errno)); + continue; + } if ((-1==ioctl(fd,EVIOCGBIT(0,sizeof(joydev.evbits)),joydev.evbits))) { perror("EVIOCGBIT 0"); @@ -319,9 +324,8 @@ static void find_joydevs(void) have_joydevs++; } - close(fd); + close(fd); } - } } static void fill_joystick_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)