Don't hide zero-length strings when doing sysctl listings.

MFC after:	1 week
This commit is contained in:
Hans Petter Selasky 2014-06-27 15:23:12 +00:00
parent cde1f5b8a0
commit 04006eabea
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=267960

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];