diff --git a/tests/sys/kern/unix_dgram.c b/tests/sys/kern/unix_dgram.c index 891cc4a58f5c..9e9d4881a61e 100644 --- a/tests/sys/kern/unix_dgram.c +++ b/tests/sys/kern/unix_dgram.c @@ -156,10 +156,13 @@ ATF_TC_BODY(basic, tc) ATF_REQUIRE(send(fd[0], buf, maxdgram, 0) == -1); ATF_REQUIRE(errno == ENOBUFS); - /* Fail with EAGAIN with O_NONBLOCK set. */ + /* + * Fail with ENOBUFS with O_NONBLOCK set, too. See 71e70c25c00 + * for explanation why this behavior needs to be preserved. + */ ATF_REQUIRE(fcntl(fd[0], F_SETFL, O_NONBLOCK) != -1); ATF_REQUIRE(send(fd[0], buf, maxdgram, 0) == -1); - ATF_REQUIRE(errno == EAGAIN); + ATF_REQUIRE(errno == ENOBUFS); /* Remote side closed -> ECONNRESET. */ close(fd[1]); diff --git a/tests/sys/kern/unix_passfd_test.c b/tests/sys/kern/unix_passfd_test.c index 92b8d73f2f4a..16a9a304bf3a 100644 --- a/tests/sys/kern/unix_passfd_test.c +++ b/tests/sys/kern/unix_passfd_test.c @@ -532,8 +532,13 @@ ATF_TC_BODY(send_overflow, tc) nfiles = openfiles(); tempfile(&putfd); len = sendfd_payload(fd[0], putfd, buf, sendspace); +#if TEST_PROTO == SOCK_STREAM ATF_REQUIRE_MSG(len == -1 && errno == EAGAIN, "sendmsg: %zu bytes sent, errno %d", len, errno); +#elif TEST_PROTO == SOCK_DGRAM + ATF_REQUIRE_MSG(len == -1 && errno == ENOBUFS, + "sendmsg: %zu bytes sent, errno %d", len, errno); +#endif close(putfd); ATF_REQUIRE(nfiles == openfiles()); closesocketpair(fd);