Skip to content

Commit

Permalink
2005-07-13 Ulrich Drepper <drepper@redhat.com>
Browse files Browse the repository at this point in the history
	[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.
  • Loading branch information
Roland McGrath committed Jul 18, 2005
1 parent 2103815 commit 82efd76
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions nscd/connections.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 82efd76

Please sign in to comment.