summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-01-28 17:47:27 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-01-28 17:47:27 +0000
commit328569ec35f7f78497c1bc1321a8e810fe54ec50 (patch)
tree24cb4c8b8898165448a3a561aa71c7e837140318
parent8641355a2d81c68e8a5eee109a9ce401c571b82f (diff)
don't permit freeaddrinfo(NULL). now the behavior is consistent
across {free,net,open}bsd. both rfc2553 and X/Open spec are silent about the behavior, and there's no strong consensus either. i think library should NOT be forgiving in this case, to promote development of more robust 3rd-party codebase (code works on "freeaddrinfo(NULL) = SEGV" will work on "freeaddrinfo(NULL) is okay" environment, but not the other way around). only issue i have now is NRL freeaddrinfo() compatibility, which permits freeaddrinfo(NULL).
-rw-r--r--lib/libc/net/freeaddrinfo.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/net/freeaddrinfo.c b/lib/libc/net/freeaddrinfo.c
index 40534f44224..30fbecb805a 100644
--- a/lib/libc/net/freeaddrinfo.c
+++ b/lib/libc/net/freeaddrinfo.c
@@ -39,11 +39,11 @@ freeaddrinfo(ai)
{
struct addrinfo *p;
- while (ai) {
+ do {
p = ai;
ai = ai->ai_next;
if (p->ai_canonname)
free(p->ai_canonname);
free((void *)p);
- }
+ } while (ai);
}