From: Andrew Cooper Date: Wed, 26 Nov 2014 15:09:40 +0000 (+0000) Subject: tools/oxenstored: Fix | vs & error in fd event handling X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e01898f17ca667c2630c8b7dfe43490f48331e53;p=people%2Fsstabellini%2Fxen-unstable.git%2F.git tools/oxenstored: Fix | vs & error in fd event handling This makes fields 0 and 1 true more often than they should be, resulting problems when handling events. Signed-off-by: Andrew Cooper CC: Ian Campbell CC: Ian Jackson CC: Wei Liu CC: Dave Scott CC: Zheng Li CC: Konrad Rzeszutek Wilk Reviewed-by: Zheng Li Reviewed-by: David Scott --- diff --git a/tools/ocaml/xenstored/select_stubs.c b/tools/ocaml/xenstored/select_stubs.c index 4a8edb5548..af72b84fa2 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); }