This makes fields 0 and 1 true more often than they should be, resulting
problems when handling events.

Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
CC: Ian Campbell <ian.campb...@citrix.com>
CC: Ian Jackson <ian.jack...@eu.citrix.com>
CC: Wei Liu <wei.l...@citrix.com>
CC: Dave Scott <dave.sc...@eu.citrix.com>
CC: Zheng Li <zheng....@citrix.com>
CC: Konrad Rzeszutek Wilk <konrad.w...@oracle.com>

---

This was discovered with XenServers internal Coverity instance.  I have yet to
work out why the issue is not identified by the upstream coverity scanning.

Konrad: This is a bug in the default event handling used by oxenstored in 4.5,
as the default switched from select() to poll() in the 4.5 timeframe.  It
would appear that the negative side effects are limited to just logspam about
certain clients attempting invalid actions, but I can't rule out anything more
problematic.
---
 tools/ocaml/xenstored/select_stubs.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/select_stubs.c 
b/tools/ocaml/xenstored/select_stubs.c
index 4a8edb5..af72b84 100644
--- a/tools/ocaml/xenstored/select_stubs.c
+++ b/tools/ocaml/xenstored/select_stubs.c
@@ -56,8 +56,8 @@ CAMLprim value stub_select_on_poll(value fd_events, value 
timeo) {
                        events = Field(Field(fd_events, i), 1);
 
                        if (c_fds[i].revents & POLLNVAL) unix_error(EBADF, 
"select", Nothing);
-                       Field(events, 0) = Val_bool(c_fds[i].events | POLLIN  
&& c_fds[i].revents & (POLLIN |POLLHUP|POLLERR));
-                       Field(events, 1) = Val_bool(c_fds[i].events | POLLOUT 
&& c_fds[i].revents & (POLLOUT|POLLHUP|POLLERR));
+                       Field(events, 0) = Val_bool(c_fds[i].events & POLLIN  
&& c_fds[i].revents & (POLLIN |POLLHUP|POLLERR));
+                       Field(events, 1) = Val_bool(c_fds[i].events & POLLOUT 
&& c_fds[i].revents & (POLLOUT|POLLHUP|POLLERR));
                        Field(events, 2) = Val_bool(c_fds[i].revents & POLLPRI);
 
                }
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to