unix/dgram tests: match the kernel behavior
In CURRENT for some time an overflowed unix/dgram socket would
return EAGAIN if it has O_NONBLOCK set. This proved to be
undesired. See 71e70c25c0
for details. Update tests to match
the "new" behavior, which actually is the historical behavior.
This commit is contained in:
parent
3ff497061b
commit
a170657108
@ -156,10 +156,13 @@ ATF_TC_BODY(basic, tc)
|
|||||||
ATF_REQUIRE(send(fd[0], buf, maxdgram, 0) == -1);
|
ATF_REQUIRE(send(fd[0], buf, maxdgram, 0) == -1);
|
||||||
ATF_REQUIRE(errno == ENOBUFS);
|
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(fcntl(fd[0], F_SETFL, O_NONBLOCK) != -1);
|
||||||
ATF_REQUIRE(send(fd[0], buf, maxdgram, 0) == -1);
|
ATF_REQUIRE(send(fd[0], buf, maxdgram, 0) == -1);
|
||||||
ATF_REQUIRE(errno == EAGAIN);
|
ATF_REQUIRE(errno == ENOBUFS);
|
||||||
|
|
||||||
/* Remote side closed -> ECONNRESET. */
|
/* Remote side closed -> ECONNRESET. */
|
||||||
close(fd[1]);
|
close(fd[1]);
|
||||||
|
@ -532,8 +532,13 @@ ATF_TC_BODY(send_overflow, tc)
|
|||||||
nfiles = openfiles();
|
nfiles = openfiles();
|
||||||
tempfile(&putfd);
|
tempfile(&putfd);
|
||||||
len = sendfd_payload(fd[0], putfd, buf, sendspace);
|
len = sendfd_payload(fd[0], putfd, buf, sendspace);
|
||||||
|
#if TEST_PROTO == SOCK_STREAM
|
||||||
ATF_REQUIRE_MSG(len == -1 && errno == EAGAIN,
|
ATF_REQUIRE_MSG(len == -1 && errno == EAGAIN,
|
||||||
"sendmsg: %zu bytes sent, errno %d", len, errno);
|
"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);
|
close(putfd);
|
||||||
ATF_REQUIRE(nfiles == openfiles());
|
ATF_REQUIRE(nfiles == openfiles());
|
||||||
closesocketpair(fd);
|
closesocketpair(fd);
|
||||||
|
Loading…
Reference in New Issue
Block a user