mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
tests: fix unix_passfd_dgram:rights_creds_payload after be1f485d7d
The test was failing due to the assert on lack of MSG_TRUNC flag in the output flags of recvmsg(). The code passed MSG_TRUNC, along with sufficient-size buffer to hold the message to-be-received to the recvmsg(), and expected MSG_TRUNC to be returned as well. This is not exactly correct as a) MSG_TRUNC was not even a supported recvmsg() flag beforebe1f485d7d
and b) it violates POSIX, as POSIX states it should be set only "If a message is too long to fit in the supplied buffers,". The test was working before as the kernel copied input flags to the output flags.be1f485d7d
changed that behaviour to clear MSG_TRUNC if it was present on the input. Fix the test by checking POSIX-defined behaviour. Discussed with: glebius
This commit is contained in:
parent
5c23343b8c
commit
f28532a0f3
|
@ -255,9 +255,8 @@ recvfd_payload(int sockfd, int *recv_fd, void *buf, size_t buflen,
|
|||
"recvmsg: did not receive single-fd message");
|
||||
ATF_REQUIRE_MSG(!localcreds(sockfd) || foundcreds,
|
||||
"recvmsg: expected credentials were not received");
|
||||
if (recvmsg_flags & MSG_TRUNC)
|
||||
ATF_REQUIRE_MSG(msghdr.msg_flags & MSG_TRUNC,
|
||||
"recvmsg: expected MSG_TRUNC missing");
|
||||
ATF_REQUIRE_MSG((msghdr.msg_flags & MSG_TRUNC) == 0,
|
||||
"recvmsg: MSG_TRUNC is set while buffer is sufficient");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -584,8 +583,7 @@ ATF_TC_BODY(rights_creds_payload, tc)
|
|||
ATF_REQUIRE_MSG((size_t)len == sendspace,
|
||||
"sendmsg: %zu bytes sent", len);
|
||||
recvfd_payload(fd[1], &getfd, buf, len,
|
||||
CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + CMSG_SPACE(sizeof(int)),
|
||||
MSG_TRUNC);
|
||||
CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + CMSG_SPACE(sizeof(int)), 0);
|
||||
#endif
|
||||
|
||||
close(putfd);
|
||||
|
|
Loading…
Reference in a new issue