$NetBSD: patch-ab,v 1.1 2000/01/17 05:34:34 christos Exp $ --- fake-getaddrinfo.c.orig Sun Jan 16 23:45:39 2000 +++ fake-getaddrinfo.c Sun Jan 16 23:47:45 2000 @@ -41,7 +41,7 @@ do { next = ai->ai_next; free(ai); - } while (ai = next); + } while ((ai = next) != NULL); } #endif /* !HAVE_FREEADDRINFO */ @@ -53,8 +53,8 @@ { struct addrinfo *ai; - if (ai = (struct addrinfo *)malloc(sizeof(struct addrinfo) + - sizeof(struct sockaddr_in))) { + if ((ai = (struct addrinfo *)malloc(sizeof(struct addrinfo) + + sizeof(struct sockaddr_in))) != NULL) { memset(ai, 0, sizeof(struct addrinfo) + sizeof(struct sockaddr_in)); ai->ai_addr = (struct sockaddr *)(ai + 1); /* XXX -- ssh doesn't use sa_len */ @@ -83,25 +83,27 @@ else port = 0; if (hints && hints->ai_flags & AI_PASSIVE) - if (*res = malloc_ai(port, htonl(0x00000000))) + if ((*res = malloc_ai(port, htonl(0x00000000))) != NULL) return 0; else return EAI_MEMORY; - if (!hostname) - if (*res = malloc_ai(port, htonl(0x7f000001))) + if (!hostname) { + if ((*res = malloc_ai(port, htonl(0x7f000001))) != NULL) return 0; else return EAI_MEMORY; - if (inet_addr(hostname) != -1) - if (*res = malloc_ai(port, inet_addr(hostname))) + } + if (inet_addr(hostname) != -1) { + if ((*res = malloc_ai(port, inet_addr(hostname))) != NULL) return 0; else return EAI_MEMORY; + } if ((hp = gethostbyname(hostname)) && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) { for (i = 0; hp->h_addr_list[i]; i++) - if (cur = malloc_ai(port, - ((struct in_addr *)hp->h_addr_list[i])->s_addr)) { + if ((cur = malloc_ai(port, + ((struct in_addr *)hp->h_addr_list[i])->s_addr)) != NULL) { if (prev) prev->ai_next = cur; else