Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jul 2014 06:05:39 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r268244 - stable/9/sbin/sysctl
Message-ID:  <201407040605.s6465di2043282@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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];
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407040605.s6465di2043282>