summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@eurogiciel.fr>2013-08-26 12:06:37 +0200
committerEduardo Lima (Etrunko) <eduardo.lima@intel.com>2013-12-17 11:46:12 -0200
commit55c4af5dbba4eda51c7da6b024453d6c95a7a360 (patch)
treeaf9103641618bbcd51b2d04afa01025bf7ee0041
parent4e425d92bd49ad0aed7691ac88aadc96672c0de6 (diff)
Fix a bug when fd is negative (what is possible --see poll man page--)
-rw-r--r--src/lib/ecore/ecore_glib.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/ecore/ecore_glib.c b/src/lib/ecore/ecore_glib.c
index a4db0ab5..063e0a0e 100644
--- a/src/lib/ecore/ecore_glib.c
+++ b/src/lib/ecore/ecore_glib.c
@@ -84,6 +84,10 @@ _ecore_glib_context_poll_from(const GPollFD *pfds,
84 84
85 for (; itr < itr_end; itr++) 85 for (; itr < itr_end; itr++)
86 { 86 {
87 /* ignore invalid values (mainly negative ones) */
88 if (itr->fd <0 || itr->fd >= FD_SETSIZE)
89 continue;
90
87 if (glib_fds < itr->fd) 91 if (glib_fds < itr->fd)
88 glib_fds = itr->fd; 92 glib_fds = itr->fd;
89 93
@@ -110,6 +114,10 @@ _ecore_glib_context_poll_to(GPollFD *pfds,
110 114
111 for (; (itr < itr_end) && (ready > 0); itr++) 115 for (; (itr < itr_end) && (ready > 0); itr++)
112 { 116 {
117 /* ignore invalid values (mainly negative ones) */
118 if (itr->fd <0 || itr->fd >= FD_SETSIZE)
119 continue;
120
113 itr->revents = 0; 121 itr->revents = 0;
114 if (FD_ISSET(itr->fd, rfds) && (itr->events & G_IO_IN)) 122 if (FD_ISSET(itr->fd, rfds) && (itr->events & G_IO_IN))
115 { 123 {