On Sat, Mar 30, 2013 at 04:39:47PM +0100, Alexander Bluhm wrote:
> On Sat, Mar 30, 2013 at 02:30:55PM +0000, Stuart Henderson wrote:
> > Most other OS are going to be using something closer to the libbind
> > (ISC) resolver which allows this so I think it would make more sense to
> > adjust getaddrinfo_async_run() to allow '0' for raw sockets, rather
> > than patch users.
>
> Makes sense.
>
> > Thinking possibly something like this, but untested:
>
> This fixes my problem.
>
This is a simpler diff. get_port() returns 0 if servname is NULL, and
the last argument is just a boolean.
Eric.
Index: getaddrinfo_async.c
===================================================================
RCS file: /cvs/src/lib/libc/asr/getaddrinfo_async.c,v
retrieving revision 1.12
diff -u -r1.12 getaddrinfo_async.c
--- getaddrinfo_async.c 28 Mar 2013 11:47:23 -0000 1.12
+++ getaddrinfo_async.c 30 Mar 2013 17:23:07 -0000
@@ -170,7 +170,7 @@
}
if (ai->ai_socktype == SOCK_RAW &&
- as->as.ai.servname != NULL) {
+ get_port(as->as.ai.servname, NULL, 1) != 0) {
ar->ar_gai_errno = EAI_SERVICE;
async_set_state(as, ASR_STATE_HALT);
break;