svn commit: r238599 - head/lib/libc/net

Maksim Yevmenkin emax at FreeBSD.org
Wed Jul 18 15:52:10 UTC 2012


Author: emax
Date: Wed Jul 18 15:52:09 2012
New Revision: 238599
URL: http://svn.freebsd.org/changeset/base/238599

Log:
  Return zero from get_addrselectpolicy() when no source-address-selection
  policy is installed.
  
  MFC after:	1 week

Modified:
  head/lib/libc/net/getaddrinfo.c

Modified: head/lib/libc/net/getaddrinfo.c
==============================================================================
--- head/lib/libc/net/getaddrinfo.c	Wed Jul 18 15:43:47 2012	(r238598)
+++ head/lib/libc/net/getaddrinfo.c	Wed Jul 18 15:52:09 2012	(r238599)
@@ -692,6 +692,8 @@ get_addrselectpolicy(struct policyhead *
 
 	if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), NULL, &l, NULL, 0) < 0)
 		return (0);
+	if (l == 0)
+		return (0);
 	if ((buf = malloc(l)) == NULL)
 		return (0);
 	if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), buf, &l, NULL, 0) < 0) {


More information about the svn-src-head mailing list