diff options
-rw-r--r-- | test/runner.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/runner.c b/test/runner.c index a1d7181..e1aed70 100644 --- a/test/runner.c +++ b/test/runner.c @@ -126,10 +126,12 @@ int main(int argc, char *argv[]) { while (1) { union addr client_addr; socklen_t client_size; - char buf[4096]; - ssize_t bytes_read = recvfrom(notify_sock, buf, sizeof(buf), 0, &client_addr.gen, &client_size); + char buf[4097]; + ssize_t bytes_read = recvfrom(notify_sock, buf, sizeof(buf)-1, 0, &client_addr.gen, &client_size); if (bytes_read < 1) error(EXIT_FAILURE, errno, "recvfrom"); + buf[bytes_read] = '\n'; + bytes_read++; ssize_t bytes_written = 0; while (bytes_written < bytes_read) { ssize_t n = write(2, &(buf[bytes_written]), bytes_read-bytes_written); @@ -141,7 +143,6 @@ int main(int argc, char *argv[]) { } if (bytes_written < 0) error(EXIT_FAILURE, errno, "write"); - write(2, "\n", 1); } error(EXIT_FAILURE, 0, "not reached"); return EXIT_FAILURE; |