summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/nscachedcli.c
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2006-05-02 23:02:32 +0000
committerume <ume@FreeBSD.org>2006-05-02 23:02:32 +0000
commit90151bff3d423ce26ae4898fb406e1c64b4e5ff2 (patch)
tree2c4bb202d6091fb9c485296fba8a6f8203fae90e /lib/libc/net/nscachedcli.c
parent9474672d954d893aefe55a19ef2bbc11d20baa5d (diff)
downloadFreeBSD-src-90151bff3d423ce26ae4898fb406e1c64b4e5ff2.zip
FreeBSD-src-90151bff3d423ce26ae4898fb406e1c64b4e5ff2.tar.gz
Fix alignment problem on AMD64.
Reported by: Pascal Hofstee <caelian__at__gmail.com> Submitted by: Michael Bushkov <bushman__at__rsu.ru> Tested by: Pascal Hofstee <caelian__at__gmail.com>
Diffstat (limited to 'lib/libc/net/nscachedcli.c')
-rw-r--r--lib/libc/net/nscachedcli.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/net/nscachedcli.c b/lib/libc/net/nscachedcli.c
index 374f370..d95a0e8 100644
--- a/lib/libc/net/nscachedcli.c
+++ b/lib/libc/net/nscachedcli.c
@@ -151,19 +151,19 @@ send_credentials(struct cached_connection_ *connection, int type)
struct {
struct cmsghdr hdr;
- struct cmsgcred creds;
+ char cred[CMSG_SPACE(sizeof(struct cmsgcred))];
} cmsg;
memset(&cmsg, 0, sizeof(cmsg));
- cmsg.hdr.cmsg_len = sizeof(cmsg);
+ cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(struct cmsgcred));
cmsg.hdr.cmsg_level = SOL_SOCKET;
cmsg.hdr.cmsg_type = SCM_CREDS;
memset(&cred_hdr, 0, sizeof(struct msghdr));
cred_hdr.msg_iov = &iov;
cred_hdr.msg_iovlen = 1;
- cred_hdr.msg_control = &cmsg;
- cred_hdr.msg_controllen = sizeof(cmsg);
+ cred_hdr.msg_control = (caddr_t)&cmsg;
+ cred_hdr.msg_controllen = CMSG_SPACE(sizeof(struct cmsgcred));
iov.iov_base = &type;
iov.iov_len = sizeof(int);
OpenPOWER on IntegriCloud