summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authoritojun <itojun@openbsd.org>2000-01-28 17:47:26 +0000
committeritojun <itojun@openbsd.org>2000-01-28 17:47:26 +0000
commit7f2fa8c6e1891b9db402e16ad8552b2ff833c3fd (patch)
treec523d4265958cae6883504495dd247e14f6e502c /lib/libc
parentRemove perly.y so Configure doesn't think things are missing. (diff)
downloadwireguard-openbsd-7f2fa8c6e1891b9db402e16ad8552b2ff833c3fd.tar.xz
wireguard-openbsd-7f2fa8c6e1891b9db402e16ad8552b2ff833c3fd.zip
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).
Diffstat (limited to 'lib/libc')
-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);
}