svn commit: r268244 - stable/9/sbin/sysctl

Hans Petter Selasky hselasky at FreeBSD.org
Fri Jul 4 06:05:40 UTC 2014


Author: hselasky
Date: Fri Jul  4 06:05:39 2014
New Revision: 268244
URL: http://svnweb.freebsd.org/changeset/base/268244

Log:
  MFC r267960:
  Don't hide zero-length strings when doing sysctl listings.

Modified:
  stable/9/sbin/sysctl/sysctl.c
Directory Properties:
  stable/9/sbin/sysctl/   (props changed)

Modified: stable/9/sbin/sysctl/sysctl.c
==============================================================================
--- stable/9/sbin/sysctl/sysctl.c	Fri Jul  4 06:03:54 2014	(r268243)
+++ stable/9/sbin/sysctl/sysctl.c	Fri Jul  4 06:05:39 2014	(r268244)
@@ -582,9 +582,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);
 	}
@@ -598,7 +599,6 @@ show_var(int *oid, int nlen)
 	fmt = buf;
 	oidfmt(oid, nlen, fmt, &kind);
 	p = val;
-	ctltype = (kind & CTLTYPE);
 	sign = ctl_sign[ctltype];
 	intlen = ctl_size[ctltype];
 


More information about the svn-src-stable-9 mailing list