summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Michael <cpmichael@osg.samsung.com>2016-06-30 10:47:56 -0400
committerChris Michael <cpmichael@osg.samsung.com>2016-06-30 10:47:56 -0400
commit837108050b7037b83976960ab7586bf4ea283898 (patch)
tree79d8d8dbaca1de60787fd502bff85e2aa9323983 /src
parent6df439b3e9f9c6e1e6c8ff3c5fb49d74b4db28ef (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')
-rw-r--r--src/lib/ecore_input/ecore_input_joystick.c5
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 1f65ce4..1b17abf 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:
300static void 301static 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);