diff options
author | pjd <pjd@FreeBSD.org> | 2011-01-31 23:46:36 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2011-01-31 23:46:36 +0000 |
commit | b1efa03054e07ab902c30a2eb3b195601954dd8f (patch) | |
tree | dc4f563c799a6918c7aa5fbf615e2649ef055347 /sbin | |
parent | f5ee3977a7b32257a8acaacde32130a9fe4888d1 (diff) | |
download | FreeBSD-src-b1efa03054e07ab902c30a2eb3b195601954dd8f.zip FreeBSD-src-b1efa03054e07ab902c30a2eb3b195601954dd8f.tar.gz |
Fix build on ia64.
I found no way how to use CMSG_NXTHDR() macro on ia64 without alignment
warnings.
MFC after: 1 week
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/hastd/proto_common.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sbin/hastd/proto_common.c b/sbin/hastd/proto_common.c index ef293d6..bce3fbf 100644 --- a/sbin/hastd/proto_common.c +++ b/sbin/hastd/proto_common.c @@ -113,7 +113,7 @@ proto_common_descriptor_send(int sock, int fd) 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, int *fdp) 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); } |