svn commit: r218148 - head/sbin/hastd
Pawel Jakub Dawidek
pjd at FreeBSD.org
Mon Jan 31 23:46:36 UTC 2011
Author: pjd
Date: Mon Jan 31 23:46:36 2011
New Revision: 218148
URL: http://svn.freebsd.org/changeset/base/218148
Log:
Fix build on ia64.
I found no way how to use CMSG_NXTHDR() macro on ia64 without alignment
warnings.
MFC after: 1 week
Modified:
head/sbin/hastd/proto_common.c
Modified: head/sbin/hastd/proto_common.c
==============================================================================
--- head/sbin/hastd/proto_common.c Mon Jan 31 23:08:26 2011 (r218147)
+++ head/sbin/hastd/proto_common.c Mon Jan 31 23:46:36 2011 (r218148)
@@ -113,7 +113,7 @@ proto_common_descriptor_send(int sock, i
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
cmsg->cmsg_len = CMSG_LEN(sizeof(fd));
-// *((int *)CMSG_DATA(cmsg)) = fd;
+ bcopy(&fd, CMSG_DATA(cmsg), sizeof(fd));
if (sendmsg(sock, &msg, 0) == -1)
return (errno);
@@ -142,14 +142,12 @@ proto_common_descriptor_recv(int sock, i
if (recvmsg(sock, &msg, 0) == -1)
return (errno);
- for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL;
- cmsg = CMSG_NXTHDR(&msg, cmsg)) {
- if (cmsg->cmsg_level == SOL_SOCKET &&
- cmsg->cmsg_type == SCM_RIGHTS) {
-// *fdp = *((int *)CMSG_DATA(cmsg));
- return (0);
- }
+ cmsg = CMSG_FIRSTHDR(&msg);
+ if (cmsg->cmsg_level != SOL_SOCKET ||
+ cmsg->cmsg_type == SCM_RIGHTS) {
+ return (EINVAL);
}
+ bcopy(CMSG_DATA(cmsg), fdp, sizeof(*fdp));
- return (ENOENT);
+ return (0);
}
More information about the svn-src-head
mailing list