+2000-09-28 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/posix/getaddrinfo.c (gaih_inet): Handle req->ai_socktype
+ correctly. Reported by Felix von Leitner <leitner@convergence.de>.
+
2000-09-19 H.J. Lu <hjl@gnu.org>
* malloc/malloc.h (__memalign_hook): Fix the parameter order.
/* By using two buffers we manage to be thread safe in the case
where S != NULL. */
char tmpbufmem[L_tmpnam];
- char tmpbuf = s ?: tmpbufmem;
+ char *tmpbuf = s ?: tmpbufmem;
/* In the following call we use the buffer pointed to by S if
non-NULL although we don't know the size. But we limit the size
if ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0)
continue;
+ if (req->ai_socktype != 0
+ && req->ai_socktype != tp->socktype)
+ continue;
+
newp = (struct gaih_servtuple *)
__alloca (sizeof (struct gaih_servtuple));
st->port = htons (service->num);
}
}
+ else if (req->ai_socktype || req->ai_protocol)
+ {
+ st = __alloca (sizeof (struct gaih_servtuple));
+ st->next = NULL;
+ st->socktype = req->ai_socktype;
+ st->protocol = req->ai_protocol;
+ st->port = 0;
+ }
+ else
+ {
+ /* Neither socket type nor protocol is set. Return all socket types
+ we know about. */
+ struct gaih_servtuple **lastp = &st;
+ for (++tp; tp->name != NULL; ++tp)
+ {
+ struct gaih_servtuple *newp;
+
+ newp = __alloca (sizeof (struct gaih_servtuple));
+ newp->next = NULL;
+ newp->socktype = tp->socktype;
+ newp->protocol = tp->protocol;
+ newp->port = 0;
+
+ *lastp = newp;
+ lastp = &newp->next;
+ }
+ }
if (name != NULL)
{