devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=837108050b7037b83976960ab7586bf4ea283898

commit 837108050b7037b83976960ab7586bf4ea283898
Author: Chris Michael <cpmich...@osg.samsung.com>
Date:   Thu Jun 30 10:47:56 2016 -0400

    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 <cpmich...@osg.samsung.com>
---
 src/lib/ecore_input/ecore_input_joystick.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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)
    ssize_t len;
 
    fd = ecore_main_fd_handler_fd_get(fdHandler);
+   if (fd < 0) return ECORE_CALLBACK_RENEW;
 
    len = read(fd, &event, sizeof(event));
    if (len == -1) return ECORE_CALLBACK_RENEW;
@@ -300,7 +301,7 @@ register_failed:
 static void
 _joystick_unregister(const char *syspath)
 {
-   int   fd;
+   int fd;
    Eina_List *l, *l2;
    Joystick_Info *ji;
 
@@ -309,6 +310,8 @@ _joystick_unregister(const char *syspath)
         if (syspath == ji->system_path)
           {
              fd = ecore_main_fd_handler_fd_get(ji->fd_handler);
+             if (fd < 0) continue;
+
              close(fd);
              ecore_main_fd_handler_del(ji->fd_handler);
              joystick_list = eina_list_remove(joystick_list, ji);

-- 


Reply via email to