summaryrefslogtreecommitdiff
path: root/src/lib/ecore_file/ecore_file_monitor_inotify.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2013-08-05 11:40:02 +0100
committerChris Michael <cp.michael@samsung.com>2013-08-05 11:40:02 +0100
commit4c9c52233704e6788ce3771b4a42f5060b97272c (patch)
treeedaaa21a9385a298a59e41f714f212dcbcdf6fc8 /src/lib/ecore_file/ecore_file_monitor_inotify.c
parent65fc207951425df8e5528bc30833141e493609ea (diff)
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>
Diffstat (limited to 'src/lib/ecore_file/ecore_file_monitor_inotify.c')
-rw-r--r--src/lib/ecore_file/ecore_file_monitor_inotify.c7
1 files 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 18b80074e6..b01a4357b3 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
153 Ecore_File_Monitor *em; 153 Ecore_File_Monitor *em;
154 char buffer[16384]; 154 char buffer[16384];
155 struct inotify_event *event; 155 struct inotify_event *event;
156 int i = 0; 156 int i = 0, fd;
157 int event_size; 157 int event_size;
158 ssize_t size; 158 ssize_t size;
159 159
160 size = read(ecore_main_fd_handler_fd_get(fdh), buffer, sizeof(buffer)); 160 fd = ecore_main_fd_handler_fd_get(fdh);
161 if (fd < 0) return ECORE_CALLBACK_RENEW;
162
163 size = read(fd, buffer, sizeof(buffer));
161 while (i < size) 164 while (i < size)
162 { 165 {
163 event = (struct inotify_event *)&buffer[i]; 166 event = (struct inotify_event *)&buffer[i];