Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Jun 2014 15:23:12 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r267960 - head/sbin/sysctl
Message-ID:  <201406271523.s5RFNCSY040029@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Jun 27 15:23:12 2014
New Revision: 267960
URL: http://svnweb.freebsd.org/changeset/base/267960

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

Modified:
  head/sbin/sysctl/sysctl.c

Modified: head/sbin/sysctl/sysctl.c
==============================================================================
--- head/sbin/sysctl/sysctl.c	Fri Jun 27 15:20:34 2014	(r267959)
+++ head/sbin/sysctl/sysctl.c	Fri Jun 27 15:23:12 2014	(r267960)
@@ -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];
 



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