Check for valid fd returned from ecore_main_fd_handler_fd_get before

potentially passing -1 to the read() function.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-08-05 11:40:02 +01:00
parent 65fc207951
commit 4c9c522337
1 changed files with 5 additions and 2 deletions

View File

@ -153,11 +153,14 @@ _ecore_file_monitor_inotify_handler(void *data EINA_UNUSED, Ecore_Fd_Handler *fd
Ecore_File_Monitor *em;
char buffer[16384];
struct inotify_event *event;
int i = 0;
int i = 0, fd;
int event_size;
ssize_t size;
size = read(ecore_main_fd_handler_fd_get(fdh), buffer, sizeof(buffer));
fd = ecore_main_fd_handler_fd_get(fdh);
if (fd < 0) return ECORE_CALLBACK_RENEW;
size = read(fd, buffer, sizeof(buffer));
while (i < size)
{
event = (struct inotify_event *)&buffer[i];