diff options
author | hselasky <hselasky@FreeBSD.org> | 2014-06-27 15:23:12 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2014-06-27 15:23:12 +0000 |
commit | 465e750b1418c7bcbd18c4e34b36120ff51ae0fc (patch) | |
tree | 04814412c3d111c44571c8be1ed57938d3551586 /sbin | |
parent | 63fdb1686c649e658e04fc473d78ccfc263e6809 (diff) | |
download | FreeBSD-src-465e750b1418c7bcbd18c4e34b36120ff51ae0fc.zip FreeBSD-src-465e750b1418c7bcbd18c4e34b36120ff51ae0fc.tar.gz |
Don't hide zero-length strings when doing sysctl listings.
MFC after: 1 week
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/sysctl/sysctl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index a86d659..1359645 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -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]; |