Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Dec 2020 17:47:06 GMT
From:      Ryan Moeller <freqlabs@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: a5ec1dd453cd - sbin/sysctl: Always honor skip in sysctl_all
Message-ID:  <202012231747.0BNHl609059010@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by freqlabs:

URL: https://cgit.FreeBSD.org/src/commit/?id=a5ec1dd453cde12524033c7d5c68b4d68d1b2360

commit a5ec1dd453cde12524033c7d5c68b4d68d1b2360
Author:     Ryan Moeller <freqlabs@FreeBSD.org>
AuthorDate: 2020-12-23 17:42:38 +0000
Commit:     Ryan Moeller <freqlabs@FreeBSD.org>
CommitDate: 2020-12-23 17:42:38 +0000

    sbin/sysctl: Always honor skip in sysctl_all
    
    Fix broken CTLFLAG_SKIP when present on the first child of the requested
    node.
    
    We don't need to ignore skip for the first node because in sysctl_all()
    we've implicitly visited the first node already when oid is specified.
    The first call to show_var() in here is after we have iterated to the
    next node. When the command line specifically requests a non-node sysctl
    we go straight into show_var() without calling sysctl_all().
    
    Reported by:    jhb
    Reviewed by:    jhb
    Sponsored by:   iXsystems, Inc.
    Differential Revision:  https://reviews.freebsd.org/D27674
---
 sbin/sysctl/sysctl.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index a2b02c86fb4c..adfe6c6d3b2c 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -1227,7 +1227,6 @@ sysctl_all(int *oid, int len)
 	int name1[22], name2[22];
 	int i, j;
 	size_t l1, l2;
-	bool honor_skip = false;
 
 	name1[0] = CTL_SYSCTL;
 	name1[1] = (oid != NULL || Nflag || dflag || tflag) ?
@@ -1258,12 +1257,11 @@ sysctl_all(int *oid, int len)
 		if (memcmp(name2, oid, len * sizeof(int)) != 0)
 			return (0);
 
-		i = show_var(name2, l2, honor_skip);
+		i = show_var(name2, l2, true);
 		if (!i && !bflag)
 			putchar('\n');
 
 		memcpy(name1 + 2, name2, l2 * sizeof(int));
 		l1 = 2 + l2;
-		honor_skip = true;
 	}
 }



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