svn commit: r345215 - projects/capsicum-test/contrib/capsicum-test
Enji Cooper
ngie at FreeBSD.org
Sat Mar 16 03:16:45 UTC 2019
Author: ngie
Date: Sat Mar 16 03:16:44 2019
New Revision: 345215
URL: https://svnweb.freebsd.org/changeset/base/345215
Log:
Revert r345214
It's best to not repeat the mistake I made in r300167; I should use
`NO_WCAST_ALIGN` instead.
Modified:
projects/capsicum-test/contrib/capsicum-test/capability-fd.cc
Modified: projects/capsicum-test/contrib/capsicum-test/capability-fd.cc
==============================================================================
--- projects/capsicum-test/contrib/capsicum-test/capability-fd.cc Sat Mar 16 03:03:25 2019 (r345214)
+++ projects/capsicum-test/contrib/capsicum-test/capability-fd.cc Sat Mar 16 03:16:44 2019 (r345215)
@@ -982,14 +982,12 @@ FORK_TEST_ON(Capability, SocketTransfer, TmpFile("cap_
// Child: enter cap mode
EXPECT_OK(cap_enter());
- int cap_fd;
-
// Child: wait to receive FD over socket
int rc = recvmsg(sock_fds[0], &mh, 0);
EXPECT_OK(rc);
EXPECT_LE(CMSG_LEN(sizeof(int)), mh.msg_controllen);
cmptr = CMSG_FIRSTHDR(&mh);
- memcpy(&cap_fd, CMSG_DATA(cmptr), sizeof(int));
+ int cap_fd = *(int*)CMSG_DATA(cmptr);
EXPECT_EQ(CMSG_LEN(sizeof(int)), cmptr->cmsg_len);
cmptr = CMSG_NXTHDR(&mh, cmptr);
EXPECT_TRUE(cmptr == NULL);
@@ -1024,7 +1022,7 @@ FORK_TEST_ON(Capability, SocketTransfer, TmpFile("cap_
cmptr->cmsg_level = SOL_SOCKET;
cmptr->cmsg_type = SCM_RIGHTS;
cmptr->cmsg_len = CMSG_LEN(sizeof(int));
- memcpy(CMSG_DATA(cmptr), &cap_fd, sizeof(int));
+ *(int *)CMSG_DATA(cmptr) = cap_fd;
buffer1[0] = 0;
iov[0].iov_len = 1;
sleep(3);
More information about the svn-src-projects
mailing list