@@ -279,6 +279,15 @@ static ssize_t do_rnd_read(const int fd, char *buf, const size_t len)
return read(fd, buf, cap);
}
+static void set_nonblock(int fd)
+{
+ int flags = fcntl(fd, F_GETFL);
+ if (flags == -1)
+ return;
+
+ fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+}
+
static int copyfd_io_poll(int infd, int peerfd, int outfd)
{
struct pollfd fds = {
@@ -288,6 +297,8 @@ static int copyfd_io_poll(int infd, int peerfd, int outfd)
unsigned int woff = 0, wlen = 0;
char wbuf[8192];
+ set_nonblock(peerfd);
+
for (;;) {
char rbuf[8192];
ssize_t len;
This change makes tests fail because mptcp_poll may signal POLLIN when no data is there and POLLOUT when it should not. Rest of series addresses this and makes selftest work again. Signed-off-by: Florian Westphal <fw@strlen.de> --- tools/testing/selftests/net/mptcp/mptcp_connect.c | 11 +++++++++++ 1 file changed, 11 insertions(+)