test_event_fd1 error only on read
authorStefan Metzmacher <metze@samba.org>
Thu, 28 Feb 2013 15:22:54 +0000 (16:22 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 17 May 2018 07:52:31 +0000 (09:52 +0200)
lib/tevent/testsuite.c

index 3c1ae01670991f8e92a2df9208b2be33e761ab45..8249fcf1dc09597b44d581c0a8c11b1f21ea4647 100644 (file)
@@ -280,13 +280,28 @@ static void test_event_fd1_fde_handler(struct tevent_context *ev_ctx,
 
                ret = read(state->sock[0], &c, 1);
                if (ret == 1) {
+                       if (flags != (TEVENT_FD_READ|TEVENT_FD_WRITE)) {
+                               state->finished = true;
+                               state->error = __location__;
+                               return;
+                       }
+                       return;
+               }
+
+               /*
+                * EOF and errors should be just reported
+                * by TEVENT_FD_READ.
+                */
+               if (flags != TEVENT_FD_READ) {
+                       state->finished = true;
+                       state->error = __location__;
                        return;
                }
 
                /*
                 * end of test...
                 */
-               tevent_fd_set_flags(fde, 0);
+               TEVENT_FD_NOT_READABLE(fde);
                state->drain_done = true;
                return;
        }