From c33dd41c07c4c4578f546798264b7f467d6a7866 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 22 Oct 2018 17:20:30 +0200 Subject: [PATCH] Prevent sptps_test from sending overly large UDP packets. This fixes the test suite on macOS, which has a lo0 interface with an MTU of 16384, which is smaller than the maximum packet size we could send. --- src/sptps_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sptps_test.c b/src/sptps_test.c index 0452b25c..ea81a28d 100644 --- a/src/sptps_test.c +++ b/src/sptps_test.c @@ -370,6 +370,7 @@ int main(int argc, char *argv[]) { } char buf[65535] = ""; + size_t readsize = datagram ? 1460u : sizeof(buf); fd_set fds; FD_ZERO(&fds); @@ -387,7 +388,7 @@ int main(int argc, char *argv[]) { } if(FD_ISSET(in, &fds)) { - ssize_t len = read(in, buf, sizeof(buf)); + ssize_t len = read(in, buf, readsize); if(len < 0) { fprintf(stderr, "Could not read from stdin: %s\n", strerror(errno)); -- 2.20.1