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
Change-Id: I2930c305ad6f9a3606807498aff490b218c0efe6
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
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;
static void
_joystick_unregister(const char *syspath)
{
- int fd;
+ int fd;
Eina_List *l, *l2;
Joystick_Info *ji;
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);