about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2005-07-18 08:01:49 +0000
committerRoland McGrath <roland@gnu.org>2005-07-18 08:01:49 +0000
commit82efd761cd54ce5f510a1ea9b8b368d6ff3c4bcb (patch)
treeb8d89412bf38518a23be955d19fddffd3b5e2e43
parent21038157e45f37d493c98fc886f3d2b16b74207b (diff)
downloadglibc-82efd761cd54ce5f510a1ea9b8b368d6ff3c4bcb.tar.gz
glibc-82efd761cd54ce5f510a1ea9b8b368d6ff3c4bcb.tar.xz
glibc-82efd761cd54ce5f510a1ea9b8b368d6ff3c4bcb.zip
2005-07-13 Ulrich Drepper <drepper@redhat.com> cvs/fedora-glibc-2_3-20050718T0804
	[BZ #1080]
	* 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.
	(__nscd_open_socket): Likewise.
	(get_mapping): Make sure BUF is aligned correctly.
	(get_mapping): Use munmap on correct pointer.
-rw-r--r--nscd/connections.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/nscd/connections.c b/nscd/connections.c
index d4ce2d345e..1a7dc77694 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;