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

policy is installed.

MFC after:	1 week
This commit is contained in:
Maksim Yevmenkin 2012-07-18 15:52:09 +00:00
parent bc84db6267
commit 0c19b5de29
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=238599

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) {