From: Ulrich Drepper Date: Thu, 14 Jul 2005 02:17:58 +0000 (+0000) Subject: * nscd/connections.c (send_ro_fd): Make sure BUF is aligned correctly. X-Git-Tag: upstream/2.30~16574 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a08ab89700a4a2e60c4c99df5b23960427e19eeb;p=external%2Fglibc.git * nscd/connections.c (send_ro_fd): Make sure BUF is aligned correctly. --- diff --git a/ChangeLog b/ChangeLog index b6ce28a..3814c07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2005-07-13 Ulrich Drepper + * nscd/connections.c (send_ro_fd): Make sure BUF is aligned correctly. * nscd/nscd_helper.c (wait_on_socket): New function. (get_mapping): Use wait_on_socket instead of poll. The former handles EINTR of poll correctly. diff --git a/nscd/connections.c b/nscd/connections.c index 8179cb2..9dc852a 100644 --- a/nscd/connections.c +++ b/nscd/connections.c @@ -604,9 +604,14 @@ send_ro_fd (struct database_dyn *db, char *key, int fd) iov[0].iov_len = strlen (key) + 1; /* Prepare the control message to transfer the descriptor. */ - char buf[CMSG_SPACE (sizeof (int))]; + union + { + struct cmsghdr hdr; + char bytes[CMSG_SPACE (sizeof (int))]; + } buf; struct msghdr msg = { .msg_iov = iov, .msg_iovlen = 1, - .msg_control = buf, .msg_controllen = sizeof (buf) }; + .msg_control = buf.bytes, + .msg_controllen = sizeof (buf) }; struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg); cmsg->cmsg_level = SOL_SOCKET;