__set_errno (ENOENT);
nscd_getgr_r (const char *key, size_t keylen, request_type type,	      struct group *resultbuf, char *buffer, size_t buflen){  int sock = open_socket ();  request_header req;  gr_response_header gr_resp;  ssize_t nbytes;  struct iovec vec[2];  if (sock == -1)    {      __nss_not_use_nscd_group = 1;      return 1;    }  req.version = NSCD_VERSION;  req.type = type;  req.key_len = keylen;  vec[0].iov_base = &req;  vec[0].iov_len = sizeof (request_header);  vec[1].iov_base = (void *) key;  vec[1].iov_len = keylen;  if (__writev (sock, vec, 2) != sizeof (request_header) + keylen)    {      __close (sock);      return 1;    }  nbytes = __read (sock, &gr_resp, sizeof (gr_response_header));  if (nbytes != sizeof (gr_response_header))    {      __close (sock);      return 1;    }  if (gr_resp.found == -1)    {      /* The daemon does not cache this database.  */      __close (sock);      __nss_not_use_nscd_group = 1;      return 1;    }  if (gr_resp.found == 1)    {      size_t *len;      char *p = buffer;      size_t total_len;      uintptr_t align;      size_t cnt;      /* Now allocate the buffer the array for the group members.  We must	 align the pointer.  */      align = ((__alignof__ (char *) - (p - ((char *) 0)))	       & (__alignof__ (char *) - 1));      if (buflen < (align + (1 + gr_resp.gr_mem_cnt) * sizeof (char *)		    + gr_resp.gr_name_len + gr_resp.gr_passwd_len))	{	no_room:	  __set_errno (ERANGE);	  __close (sock);	  return -1;	}      p += align;      resultbuf->gr_mem = (char **) p;      p += (1 + gr_resp.gr_mem_cnt) * sizeof (char *);      buflen -= align + (1 + gr_resp.gr_mem_cnt) * sizeof (char *);      /* Set pointers for strings.  */      resultbuf->gr_name = p;      p += gr_resp.gr_name_len;      resultbuf->gr_passwd = p;      p += gr_resp.gr_passwd_len;      /* Fill in what we know now.  */      resultbuf->gr_gid = gr_resp.gr_gid;      /* Allocate array to store lengths.  */      len = alloca (gr_resp.gr_mem_cnt * sizeof (size_t));      total_len = gr_resp.gr_mem_cnt * sizeof (size_t);      vec[0].iov_base = len;      vec[0].iov_len = total_len;      vec[1].iov_base = resultbuf->gr_name;      vec[1].iov_len = gr_resp.gr_name_len + gr_resp.gr_passwd_len;      total_len += gr_resp.gr_name_len + gr_resp.gr_passwd_len;      buflen -= total_len;      /* Get this data.  */      if (__readv (sock, vec, 2) != total_len)	{	  __close (sock);	  return 1;	}      /* Clear the terminating entry.  */      resultbuf->gr_mem[gr_resp.gr_mem_cnt] = NULL;      /* Prepare reading the group members.  */      total_len = 0;      for (cnt = 0; cnt < gr_resp.gr_mem_cnt; ++cnt)	{	  resultbuf->gr_mem[cnt] = p;	  total_len += len[cnt];	  p += len[cnt];	}      if (total_len > buflen)	goto no_room;      if (__read (sock, resultbuf->gr_mem[0], total_len) != total_len)	{	  __close (sock);	  return -1;	}      __close (sock);      return 0;    }  else    {      __close (sock);      return -1;    }}