[50 character or so descriptive subject here (for reference)]
Ulrich Drepper
drepper@redhat.com
Thu Sep 28 22:26:00 GMT 2000
leitner@convergence.de writes:
> >Description:
> lukemftp does not work because it calls socket with 0 as second
> parameter and gets EINVAL from the kernel. I looked in the
> source code of lukemftp and found that it uses res->ai_socktype
> from the res that it got from getaddrinfo.
I'll certainly not install BSD software but you could give the
appended patch a try. It hopefully fixes a few ai_socktype related
bugs, among them probably the one you are experiencing.
--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: getaddrinfo.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/posix/getaddrinfo.c,v
retrieving revision 1.31
diff -u -d -u -p -r1.31 getaddrinfo.c
--- getaddrinfo.c 2000/09/29 02:54:52 1.31
+++ getaddrinfo.c 2000/09/29 05:25:12
@@ -356,6 +356,10 @@ gaih_inet (const char *name, const struc
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));
@@ -380,6 +384,33 @@ gaih_inet (const char *name, const struc
st->socktype = tp->socktype;
st->protocol = tp->protocol;
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;
}
}
More information about the Libc-alpha
mailing list