From f3c54060af56e255844545fb566b83fcd6e9e9f5 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 29 Aug 2007 06:10:07 +0000 Subject: * nscd/connections.c (send_ro_fd): Also transfer file size. * nscd/nscd_helper.c (get_mapping): If nscd also transfers the file size don't call fstat. --- nscd/connections.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'nscd/connections.c') diff --git a/nscd/connections.c b/nscd/connections.c index e435fa8b27..11fbc03498 100644 --- a/nscd/connections.c +++ b/nscd/connections.c @@ -907,9 +907,14 @@ send_ro_fd (struct database_dyn *db, char *key, int fd) return; /* We need to send some data along with the descriptor. */ - struct iovec iov[1]; + uint64_t mapsize = (db->head->data_size + + roundup (db->head->module * sizeof (ref_t), ALIGN) + + sizeof (struct database_pers_head)); + struct iovec iov[2]; iov[0].iov_base = key; iov[0].iov_len = strlen (key) + 1; + iov[1].iov_base = &mapsize; + iov[1].iov_len = sizeof (mapsize); /* Prepare the control message to transfer the descriptor. */ union @@ -917,7 +922,7 @@ send_ro_fd (struct database_dyn *db, char *key, int fd) struct cmsghdr hdr; char bytes[CMSG_SPACE (sizeof (int))]; } buf; - struct msghdr msg = { .msg_iov = iov, .msg_iovlen = 1, + struct msghdr msg = { .msg_iov = iov, .msg_iovlen = 2, .msg_control = buf.bytes, .msg_controllen = sizeof (buf) }; struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg); -- cgit v1.2.3