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>
Tue, 4 Oct 2016 12:52:14 +0000 (14:52 +0200)
lib/tevent/testsuite.c

index 4783ab41153687180b5683004dd10c80092c7c63..e430764c7f58f5415ca73ffa49c7bc1ce0720cce 100644 (file)
@@ -276,13 +276,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;
        }