mirror of
git://sourceware.org/git/glibc.git
synced 2025-01-18 12:16:13 +08:00
socket/tst-cmsghdr: Fix alignment of cmsghdr
The computation was correct on Linux only by luck because the cmsghdr size is already aligned there.
This commit is contained in:
parent
4ab62ce605
commit
278f8d5c4d
@ -56,7 +56,7 @@ RUN_TEST_FUNCNAME (CMSG_NXTHDR_IMPL) (void)
|
|||||||
/* The first header leaves just enough space to hold another header. */
|
/* The first header leaves just enough space to hold another header. */
|
||||||
cmsg = CMSG_FIRSTHDR (&m);
|
cmsg = CMSG_FIRSTHDR (&m);
|
||||||
TEST_VERIFY_EXIT ((char *) cmsg == cmsgbuf);
|
TEST_VERIFY_EXIT ((char *) cmsg == cmsgbuf);
|
||||||
cmsg->cmsg_len = sizeof (cmsgbuf) - sizeof (struct cmsghdr);
|
cmsg->cmsg_len = sizeof (cmsgbuf) - CMSG_ALIGN (sizeof (struct cmsghdr));
|
||||||
cmsg = CMSG_NXTHDR_IMPL (&m, cmsg);
|
cmsg = CMSG_NXTHDR_IMPL (&m, cmsg);
|
||||||
TEST_VERIFY_EXIT (cmsg != NULL);
|
TEST_VERIFY_EXIT (cmsg != NULL);
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ RUN_TEST_FUNCNAME (CMSG_NXTHDR_IMPL) (void)
|
|||||||
TEST_VERIFY_EXIT (cmsg != NULL);
|
TEST_VERIFY_EXIT (cmsg != NULL);
|
||||||
cmsg->cmsg_len = sizeof (cmsgbuf)
|
cmsg->cmsg_len = sizeof (cmsgbuf)
|
||||||
- CMSG_SPACE (sizeof (PAYLOAD)) /* First header. */
|
- CMSG_SPACE (sizeof (PAYLOAD)) /* First header. */
|
||||||
- sizeof (struct cmsghdr);
|
- CMSG_ALIGN (sizeof (struct cmsghdr));
|
||||||
cmsg = CMSG_NXTHDR_IMPL (&m, cmsg);
|
cmsg = CMSG_NXTHDR_IMPL (&m, cmsg);
|
||||||
TEST_VERIFY_EXIT (cmsg != NULL);
|
TEST_VERIFY_EXIT (cmsg != NULL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user