summaryrefslogtreecommitdiffstats
path: root/src/sss_client/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sss_client/common.c')
-rw-r--r--src/sss_client/common.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/sss_client/common.c b/src/sss_client/common.c
index f1c8d1853..07b9d0d95 100644
--- a/src/sss_client/common.c
+++ b/src/sss_client/common.c
@@ -63,7 +63,11 @@ static int exchange_credentials(void)
struct cmsghdr *cmsg;
struct iovec iov;
char dummy='a';
- char buf[CMSG_SPACE(sizeof(struct ucred))];
+ /* buf must be aligned on some architectures. */
+ union ubuf {
+ int align;
+ char buf[CMSG_SPACE(sizeof(struct ucred))];
+ } u;
struct ucred *creds;
int enable = 1;
struct pollfd pfd;
@@ -83,8 +87,8 @@ static int exchange_credentials(void)
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
- msg.msg_control = buf;
- msg.msg_controllen = sizeof(buf);
+ msg.msg_control = u.buf;
+ msg.msg_controllen = sizeof(u.buf);
cmsg = CMSG_FIRSTHDR(&msg);
cmsg->cmsg_level = SOL_SOCKET;
@@ -118,8 +122,8 @@ static int exchange_credentials(void)
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
- msg.msg_control = buf;
- msg.msg_controllen = sizeof(buf);
+ msg.msg_control = u.buf;
+ msg.msg_controllen = sizeof(u.buf);
pfd.fd = sss_cli_sd;
pfd.events = POLLIN;