devilhorns pushed a commit to branch master.

commit 4c9c52233704e6788ce3771b4a42f5060b97272c
Author: Chris Michael <[email protected]>
Date:   Mon Aug 5 11:40:02 2013 +0100

    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 <[email protected]>
---
 src/lib/ecore_file/ecore_file_monitor_inotify.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/lib/ecore_file/ecore_file_monitor_inotify.c 
b/src/lib/ecore_file/ecore_file_monitor_inotify.c
index 18b8007..b01a435 100644
--- a/src/lib/ecore_file/ecore_file_monitor_inotify.c
+++ b/src/lib/ecore_file/ecore_file_monitor_inotify.c
@@ -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];

-- 

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk

Reply via email to