diff --git a/external/microatf/src/atf-c.c b/external/microatf/src/atf-c.c
index 05aae58..443a6d8 100644
--- a/external/microatf/src/atf-c.c
+++ b/external/microatf/src/atf-c.c
@@ -4,6 +4,7 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <errno.h>
 
 #include <fcntl.h>
 #include <unistd.h>
@@ -343,6 +344,9 @@ microatf_fail_require(char const *msg, ...)
 		    "expected_failure", -1, msg, args);
 		va_end(args);
 
+		if (errno) {
+			perror("errno:");
+		}
 		microatf_context_exit(context, EXIT_SUCCESS);
 	} else if (context->expect == MICROATF_EXPECT_PASS) {
 		va_list args;
@@ -351,6 +355,9 @@ microatf_fail_require(char const *msg, ...)
 		    "failed", -1, msg, args);
 		va_end(args);
 
+		if (errno) {
+			perror("errno:");
+		}
 		microatf_context_exit(context, EXIT_FAILURE);
 	} else {
 		va_list args;
@@ -362,6 +369,9 @@ microatf_fail_require(char const *msg, ...)
 		    "Test case raised a failure but was not expecting one");
 		va_end(args);
 
+		if (errno) {
+			perror("errno:");
+		}
 		microatf_context_exit(context, EXIT_FAILURE);
 	}
 }
diff --git a/test/epoll-test.c b/test/epoll-test.c
index f53ee97..a086a87 100644
--- a/test/epoll-test.c
+++ b/test/epoll-test.c
@@ -91,6 +96,7 @@ connector_client(void *arg)
 	struct sockaddr_in addr = { 0 };
 	addr.sin_family = AF_INET;
 	addr.sin_port = htons(1337);
+	addr.sin_len = sizeof(struct sockaddr_in);
 	ATF_REQUIRE(inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr) == 1);
 
 	ATF_REQUIRE(
@@ -1162,6 +1174,7 @@ ATF_TC_BODY_FD_LEAKCHECK(epoll__epollout_on_connecting_socket, tcptr)
 			struct sockaddr_in addr = { 0 };
 			addr.sin_family = AF_INET;
 			addr.sin_port = htons(1337);
+			addr.sin_len = sizeof(struct sockaddr_in);
 			ATF_REQUIRE(inet_pton(AF_INET, "127.0.0.1", /**/
 					&addr.sin_addr) == 1);
 
@@ -1351,7 +1364,7 @@ ATF_TC_BODY_FD_LEAKCHECK(epoll__epollpri_oobinline, tcptr)
 	ATF_REQUIRE(send(fds[1], &c, 1, MSG_OOB) == 1);
 
 	usleep(200000);
-	ATF_REQUIRE(epoll_wait(ep, &event, 1, -1) == 1);
+	ATF_REQUIRE(epoll_wait(ep, &event, 1, 5000) == 1);
 	ATF_REQUIRE(event.events == (EPOLLIN | EPOLLPRI));
 	ATF_REQUIRE(epoll_wait(ep, &event, 1, 0) == 0);
 
@@ -1361,7 +1374,7 @@ ATF_TC_BODY_FD_LEAKCHECK(epoll__epollpri_oobinline, tcptr)
 	ATF_REQUIRE(recv(fds[0], &c, 1, 0) == 1);
 	ATF_REQUIRE(c == 'o');
 
-	ATF_REQUIRE(epoll_wait(ep, &event, 1, -1) == 1);
+	ATF_REQUIRE(epoll_wait(ep, &event, 1, 5000) == 1);
 	ATF_REQUIRE(event.events == EPOLLIN);
 	ATF_REQUIRE(epoll_wait(ep, &event, 1, 0) == 0);
 
@@ -1411,11 +1424,11 @@ ATF_TC_BODY_FD_LEAKCHECK(epoll__epollpri_oobinline_lt, tcptr)
 	char c = 'o';
 	ATF_REQUIRE(send(fds[1], &c, 1, MSG_OOB) == 1);
 
-	ATF_REQUIRE(epoll_wait(ep, &event, 1, -1) == 1);
+	ATF_REQUIRE(epoll_wait(ep, &event, 1, 5000) == 1);
 	ATF_REQUIRE(event.events == EPOLLPRI);
-	ATF_REQUIRE(epoll_wait(ep, &event, 1, -1) == 1);
+	ATF_REQUIRE(epoll_wait(ep, &event, 1, 5000) == 1);
 	ATF_REQUIRE(event.events == EPOLLPRI);
-	ATF_REQUIRE(epoll_wait(ep, &event, 1, -1) == 1);
+	ATF_REQUIRE(epoll_wait(ep, &event, 1, 5000) == 1);
 	ATF_REQUIRE(event.events == EPOLLPRI);
 
 	ATF_REQUIRE(recv(fds[0], &c, 1, 0) == 1);
@@ -1455,6 +1468,7 @@ ATF_TC_BODY_FD_LEAKCHECK(epoll__timeout_on_listening_socket, tcptr)
 	struct sockaddr_in addr = { 0 };
 	addr.sin_family = AF_INET;
 	addr.sin_port = htons(1337);
+	addr.sin_len = sizeof(struct sockaddr_in);
 	ATF_REQUIRE(inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr) == 1);
 
 	ATF_REQUIRE(bind(sock, /**/
@@ -1660,6 +1674,7 @@ datagram_connector(void *arg)
 	struct sockaddr_in addr = { 0 };
 	addr.sin_family = AF_INET;
 	addr.sin_port = htons(1337);
+	addr.sin_len = sizeof(struct sockaddr_in);
 	ATF_REQUIRE(inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr) == 1);
 
 	ATF_REQUIRE(
@@ -1695,6 +1710,7 @@ ATF_TC_BODY_FD_LEAKCHECK(epoll__datagram_connection, tcptr)
 	struct sockaddr_in addr = { 0 };
 	addr.sin_family = AF_INET;
 	addr.sin_port = htons(1337);
+	addr.sin_len = sizeof(struct sockaddr_in);
 	ATF_REQUIRE(inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr) == 1);
 
 	ATF_REQUIRE(bind(sock, /**/
@@ -1713,7 +1729,7 @@ ATF_TC_BODY_FD_LEAKCHECK(epoll__datagram_connection, tcptr)
 	ATF_REQUIRE(epoll_ctl(ep, EPOLL_CTL_ADD, fds[0], &event) == 0);
 
 	struct epoll_event event_result;
-	ATF_REQUIRE(epoll_wait(ep, &event_result, 1, -1) == 1);
+	ATF_REQUIRE(epoll_wait(ep, &event_result, 1, 5000) == 1);
 
 	fprintf(stderr, "got event: %x %d\n", (int)event_result.events,
 	    (int)event_result.events);
