From owner-dev-commits-src-main@freebsd.org Wed Dec 23 17:47:07 2020 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 156914C64C2; Wed, 23 Dec 2020 17:47:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D1LHv08QNz3kyk; Wed, 23 Dec 2020 17:47:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E899522217; Wed, 23 Dec 2020 17:47:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 0BNHl6dA059011; Wed, 23 Dec 2020 17:47:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 0BNHl609059010; Wed, 23 Dec 2020 17:47:06 GMT (envelope-from git) Date: Wed, 23 Dec 2020 17:47:06 GMT Message-Id: <202012231747.0BNHl609059010@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Moeller Subject: git: a5ec1dd453cd - sbin/sysctl: Always honor skip in sysctl_all MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a5ec1dd453cde12524033c7d5c68b4d68d1b2360 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Commit messages for the main branch of the src repository." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Dec 2020 17:47:07 -0000 The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=a5ec1dd453cde12524033c7d5c68b4d68d1b2360 commit a5ec1dd453cde12524033c7d5c68b4d68d1b2360 Author: Ryan Moeller AuthorDate: 2020-12-23 17:42:38 +0000 Commit: Ryan Moeller 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; } }