git.samba.org
/
rusty
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
710444d
)
Fix the poll() backend to correctly respond to POLLHUP|POLLERR returns on a fd select...
author
Jeremy Allison
<jra@samba.org>
Fri, 3 Jun 2011 19:31:11 +0000
(12:31 -0700)
committer
Jeremy Allison
<jra@samba.org>
Fri, 3 Jun 2011 20:53:52 +0000
(22:53 +0200)
Don't trigger the write handler and remove the POLLOUT flag for this fd. Report errors on TEVENT_FD_READ requests only.
Metze please check !
Jeremy.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Jun 3 22:53:52 CEST 2011 on sn-devel-104
lib/tevent/tevent_poll.c
patch
|
blob
|
history
diff --git
a/lib/tevent/tevent_poll.c
b/lib/tevent/tevent_poll.c
index 712255b37322d01c9261ba720524fe3891d16728..0b782e99bb82b2b7bd2eba8cec9fa8a3fcf69081 100644
(file)
--- a/
lib/tevent/tevent_poll.c
+++ b/
lib/tevent/tevent_poll.c
@@
-233,7
+233,19
@@
static int poll_event_loop_poll(struct tevent_context *ev,
pfd = &poll_ev->fds[pfd_idx];
pfd = &poll_ev->fds[pfd_idx];
- if (pfd->revents & (POLLIN|POLLHUP|POLLERR)) {
+ if (pfd->revents & (POLLHUP|POLLERR)) {
+ /* If we only wait for TEVENT_FD_WRITE, we
+ should not tell the event handler about it,
+ and remove the writable flag, as we only
+ report errors when waiting for read events
+ to match the select behavior. */
+ if (!(fde->flags & TEVENT_FD_READ)) {
+ TEVENT_FD_NOT_WRITEABLE(fde);
+ continue;
+ }
+ flags |= TEVENT_FD_READ;
+ }
+ if (pfd->revents & POLLIN) {
flags |= TEVENT_FD_READ;
}
if (pfd->revents & POLLOUT) {
flags |= TEVENT_FD_READ;
}
if (pfd->revents & POLLOUT) {