Fix tevent testsuite issue on Solaris.
authorJeremy Allison <jra@samba.org>
Fri, 8 Mar 2013 21:44:08 +0000 (13:44 -0800)
committerMichael Adam <obnox@samba.org>
Fri, 22 Mar 2013 17:16:45 +0000 (18:16 +0100)
On Solaris/Nexenta/Illumos once a pipe is full it will not be reported
as writable until PIPE_BUF (actually on Solaris 4096, which is less than
PIPE_BUF) bytes have been read from it.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Fri Mar 22 18:16:45 CET 2013 on sn-devel-104

lib/tevent/testsuite.c

index 1fcfa1cac3e5a8541dca73afb980281549512be1..7851c6c92db92e6ebf710b4f5633abf8d9be5b23 100644 (file)
@@ -482,8 +482,13 @@ static void test_event_fd2_sock_handler(struct tevent_context *ev_ctx,
                return;
        }
 
-       if (oth_sock->num_read > 0) {
+       if (oth_sock->num_read >= PIPE_BUF) {
                /*
+                * On Linux we become writable once we've read
+                * one byte. On Solaris we only become writable
+                * again once we've read 4096 bytes. PIPE_BUF
+                * is probably a safe bet to test against.
+                *
                 * There should be room to write a byte again
                 */
                if (!(flags & TEVENT_FD_WRITE)) {