diff options
author | Chris Michael <cpmichael@osg.samsung.com> | 2016-06-30 10:47:56 -0400 |
---|---|---|
committer | Chris Michael <cpmichael@osg.samsung.com> | 2016-06-30 10:47:56 -0400 |
commit | 837108050b7037b83976960ab7586bf4ea283898 (patch) | |
tree | 79d8d8dbaca1de60787fd502bff85e2aa9323983 /src/lib/ecore_input/ecore_input_joystick.c | |
parent | 6df439b3e9f9c6e1e6c8ff3c5fb49d74b4db28ef (diff) |
ecore-input: Check return fo ecore_main_fd_handler_fd_get
This patch fixes 2 coverity Error handling issues.
ecore_main_fd_handler_fd_get can return a negative fd on error so we
should be checking that return before trying to make use of the fd.
Fixes Coverity CID1356632 and CID1356624
@fix
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
Diffstat (limited to 'src/lib/ecore_input/ecore_input_joystick.c')
-rw-r--r-- | src/lib/ecore_input/ecore_input_joystick.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/ecore_input/ecore_input_joystick.c b/src/lib/ecore_input/ecore_input_joystick.c index 1f65ce48db..1b17abf140 100644 --- a/src/lib/ecore_input/ecore_input_joystick.c +++ b/src/lib/ecore_input/ecore_input_joystick.c | |||
@@ -189,6 +189,7 @@ _fd_handler_cb(void* userData, Ecore_Fd_Handler* fdHandler) | |||
189 | ssize_t len; | 189 | ssize_t len; |
190 | 190 | ||
191 | fd = ecore_main_fd_handler_fd_get(fdHandler); | 191 | fd = ecore_main_fd_handler_fd_get(fdHandler); |
192 | if (fd < 0) return ECORE_CALLBACK_RENEW; | ||
192 | 193 | ||
193 | len = read(fd, &event, sizeof(event)); | 194 | len = read(fd, &event, sizeof(event)); |
194 | if (len == -1) return ECORE_CALLBACK_RENEW; | 195 | if (len == -1) return ECORE_CALLBACK_RENEW; |
@@ -300,7 +301,7 @@ register_failed: | |||
300 | static void | 301 | static void |
301 | _joystick_unregister(const char *syspath) | 302 | _joystick_unregister(const char *syspath) |
302 | { | 303 | { |
303 | int fd; | 304 | int fd; |
304 | Eina_List *l, *l2; | 305 | Eina_List *l, *l2; |
305 | Joystick_Info *ji; | 306 | Joystick_Info *ji; |
306 | 307 | ||
@@ -309,6 +310,8 @@ _joystick_unregister(const char *syspath) | |||
309 | if (syspath == ji->system_path) | 310 | if (syspath == ji->system_path) |
310 | { | 311 | { |
311 | fd = ecore_main_fd_handler_fd_get(ji->fd_handler); | 312 | fd = ecore_main_fd_handler_fd_get(ji->fd_handler); |
313 | if (fd < 0) continue; | ||
314 | |||
312 | close(fd); | 315 | close(fd); |
313 | ecore_main_fd_handler_del(ji->fd_handler); | 316 | ecore_main_fd_handler_del(ji->fd_handler); |
314 | joystick_list = eina_list_remove(joystick_list, ji); | 317 | joystick_list = eina_list_remove(joystick_list, ji); |