diff options
author | hselasky <hselasky@FreeBSD.org> | 2014-07-04 06:03:54 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2014-07-04 06:03:54 +0000 |
commit | d6648f2a8e86b7c537d32c3f51347f29e8c007d4 (patch) | |
tree | b0b36b9ca8354fa257bcb9e461c4044b095f2da1 /sbin | |
parent | 0d8378f52b85502c1b4affb9e3171b87840a9008 (diff) | |
download | FreeBSD-src-d6648f2a8e86b7c537d32c3f51347f29e8c007d4.zip FreeBSD-src-d6648f2a8e86b7c537d32c3f51347f29e8c007d4.tar.gz |
MFC r267960:
Don't hide zero-length strings when doing sysctl listings.
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]; |