Page MenuHomeFreeBSD

D26833.id78361.diff
No OneTemporary

D26833.id78361.diff

Index: sbin/sysctl/sysctl.c
===================================================================
--- sbin/sysctl/sysctl.c
+++ sbin/sysctl/sysctl.c
@@ -957,6 +957,7 @@
static int
show_var(int *oid, int nlen, bool honor_skip)
{
+ static int skip_len = 0, skip_oid[CTL_MAXNAME];
u_char buf[BUFSIZ], *val, *oval, *p;
char name[BUFSIZ], fmt[BUFSIZ];
const char *sep, *sep1, *prntype;
@@ -1027,8 +1028,21 @@
}
/* bail before fetching the value if we're honoring skip */
- if (honor_skip && (kind & CTLFLAG_SKIP) != 0)
- return (1);
+ if (honor_skip) {
+ /* Bail if this is a skip node. */
+ if ((kind & CTLFLAG_SKIP) != 0) {
+ /* Save this oid so we can skip descendants, too. */
+ skip_len = nlen * sizeof(int);
+ memcpy(skip_oid, oid, skip_len);
+ return (1);
+ }
+ /* Bail if this is a descendant of a skip node. */
+ if (skip_len > nlen * (int)sizeof(int) &&
+ memcmp(skip_oid, oid, skip_len) == 0)
+ return (1);
+ /* Not a skip node or descendant of a skip node. */
+ skip_len = 0;
+ }
/* don't fetch opaques that we don't know how to print */
if (ctltype == CTLTYPE_OPAQUE) {

File Metadata

Mime Type
text/plain
Expires
Thu, Oct 8, 4:47 AM (22 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40404132
Default Alt Text
D26833.id78361.diff (1 KB)

Event Timeline