Return zero from get_addrselectpolicy() when no source-address-selection

policy is installed.

MFC after:	1 week
This commit is contained in:
emax 2012-07-18 15:52:09 +00:00
parent e69c4af4ad
commit c9ba4f7b25

View File

@ -692,6 +692,8 @@ get_addrselectpolicy(struct policyhead *head)
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) {