Add the same fix to the S3 event backend as the previous commit added to the tevent...
authorJeremy Allison <jra@samba.org>
Fri, 3 Jun 2011 19:55:19 +0000 (12:55 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 3 Jun 2011 22:27:37 +0000 (00:27 +0200)
Metze please check !

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat Jun  4 00:27:37 CEST 2011 on sn-devel-104

source3/lib/events.c

index 9ff14880ecdbeefa968097086e22f2d6b6c51d85..fbe3db942b4d93084c976c01176d82bab15fc52e 100644 (file)
@@ -258,7 +258,20 @@ bool run_events_poll(struct tevent_context *ev, int pollrtn,
                        return false;
                }
 
-               if (pfd->revents & (POLLIN|POLLHUP|POLLERR)) {
+               if (pfd->revents & (POLLHUP|POLLERR)) {
+                       /* If we only wait for EVENT_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 & EVENT_FD_READ)) {
+                               EVENT_FD_NOT_WRITEABLE(fde);
+                               continue;
+                       }
+                       flags |= EVENT_FD_READ;
+               }
+
+               if (pfd->revents & POLLIN) {
                        flags |= EVENT_FD_READ;
                }
                if (pfd->revents & POLLOUT) {