if ((name != NULL) && (req->ai_flags & AI_NUMERICHOST)) return GAIH_OKIFUNSPEC | -EAI_NONAME;
gaih_local (const char *name, const struct gaih_service *service,	    const struct addrinfo *req, struct addrinfo **pai){  struct utsname utsname;  if ((name != NULL) || (req->ai_flags & AI_CANONNAME))    if (uname (&utsname))      return -EAI_SYSTEM;  if (name != NULL)    {      if (strcmp(name, "localhost") &&	  strcmp(name, "local") &&	  strcmp(name, "unix") &&	  strcmp(name, utsname.nodename))	return GAIH_OKIFUNSPEC | -EAI_NONAME;    }  if (req->ai_protocol || req->ai_socktype)    {      struct gaih_typeproto *tp = gaih_inet_typeproto + 1;      while (tp->name != NULL	     && (req->ai_socktype != tp->socktype || req->ai_socktype == 0)	     && ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0		 || req->ai_protocol != tp->protocol		 || req->ai_protocol == 0))	++tp;      if (tp->name == NULL)	{	  if (req->ai_socktype)	    return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE);	  else	    return (GAIH_OKIFUNSPEC | -EAI_SERVICE);	}    }  *pai = malloc (sizeof (struct addrinfo) + sizeof (struct sockaddr_un)		 + ((req->ai_flags & AI_CANONNAME)		    ? (strlen(utsname.nodename) + 1): 0));  if (*pai == NULL)    return -EAI_MEMORY;  (*pai)->ai_next = NULL;  (*pai)->ai_flags = req->ai_flags;  (*pai)->ai_family = AF_LOCAL;  (*pai)->ai_socktype = req->ai_socktype ? req->ai_socktype : SOCK_STREAM;  (*pai)->ai_protocol = req->ai_protocol;  (*pai)->ai_addrlen = sizeof (struct sockaddr_un);  (*pai)->ai_addr = (void *) (*pai) + sizeof (struct addrinfo);#if SALEN  ((struct sockaddr_un *) (*pai)->ai_addr)->sun_len =    sizeof (struct sockaddr_un);#endif /* SALEN */  ((struct sockaddr_un *)(*pai)->ai_addr)->sun_family = AF_LOCAL;  memset(((struct sockaddr_un *)(*pai)->ai_addr)->sun_path, 0, UNIX_PATH_MAX);  if (service)    {      struct sockaddr_un *sunp = (struct sockaddr_un *) (*pai)->ai_addr;      if (strchr (service->name, '/') != NULL)	{	  if (strlen (service->name) >= sizeof (sunp->sun_path))	    return GAIH_OKIFUNSPEC | -EAI_SERVICE;	  strcpy (sunp->sun_path, service->name);	}      else	{	  if (strlen (P_tmpdir "/") + 1 + strlen (service->name) >=	      sizeof (sunp->sun_path))	    return GAIH_OKIFUNSPEC | -EAI_SERVICE;	  __stpcpy (__stpcpy (sunp->sun_path, P_tmpdir "/"), service->name);	}    }  else    {      if (tmpnam (((struct sockaddr_un *) (*pai)->ai_addr)->sun_path) == NULL)	return -EAI_SYSTEM;    }  if (req->ai_flags & AI_CANONNAME)    (*pai)->ai_canonname = strcpy ((char *) *pai + sizeof (struct addrinfo)				   + sizeof (struct sockaddr_un),				   utsname.nodename);  else    (*pai)->ai_canonname = NULL;  return 0;}