From: Ulrich Drepper Date: Fri, 29 Sep 2000 05:29:24 +0000 (+0000) Subject: Update. X-Git-Tag: cvs/libc-2_1_95~54 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=84a4fd33317babb7f1fe2542aa040c26c3603971;p=platform%2Fupstream%2Fglibc.git Update. 2000-09-28 Ulrich Drepper * sysdeps/posix/getaddrinfo.c (gaih_inet): Handle req->ai_socktype correctly. Reported by Felix von Leitner . --- diff --git a/ChangeLog b/ChangeLog index e895596..8449304 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-09-28 Ulrich Drepper + + * sysdeps/posix/getaddrinfo.c (gaih_inet): Handle req->ai_socktype + correctly. Reported by Felix von Leitner . + 2000-09-19 H.J. Lu * malloc/malloc.h (__memalign_hook): Fix the parameter order. diff --git a/stdio-common/tmpnam.c b/stdio-common/tmpnam.c index fc30026..e1e11ae 100644 --- a/stdio-common/tmpnam.c +++ b/stdio-common/tmpnam.c @@ -30,7 +30,7 @@ tmpnam (char *s) /* 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 diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 7a84cd3..bbd4dd1 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -356,6 +356,10 @@ gaih_inet (const char *name, const struct gaih_service *service, 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)); @@ -382,6 +386,33 @@ gaih_inet (const char *name, const struct gaih_service *service, 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) {