MFC r267960:

Don't hide zero-length strings when doing sysctl listings.
This commit is contained in:
hselasky 2014-07-04 06:03:54 +00:00
parent 0d8378f52b
commit d6648f2a8e

View File

@ -710,9 +710,10 @@ show_var(int *oid, int nlen)
warnx("malloc failed");
return (1);
}
ctltype = (kind & CTLTYPE);
len = j;
i = sysctl(oid, nlen, val, &len, 0, 0);
if (i || !len) {
if (i != 0 || (len == 0 && ctltype != CTLTYPE_STRING)) {
free(oval);
return (1);
}
@ -724,7 +725,6 @@ show_var(int *oid, int nlen)
}
val[len] = '\0';
p = val;
ctltype = (kind & CTLTYPE);
sign = ctl_sign[ctltype];
intlen = ctl_size[ctltype];