diff options
Diffstat (limited to 'usr.sbin/jls/jls.c')
-rw-r--r-- | usr.sbin/jls/jls.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/usr.sbin/jls/jls.c b/usr.sbin/jls/jls.c index 40019f1..8c8b981 100644 --- a/usr.sbin/jls/jls.c +++ b/usr.sbin/jls/jls.c @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #define PRINT_VERBOSE 0x20 static struct jailparam *params; -static int *param_noparent; +static int *param_parent; static int nparams; static int add_param(const char *name, void *value, size_t valuelen, @@ -71,7 +71,7 @@ static void quoted_print(char *str); int main(int argc, char **argv) { - char *dot, *ep, *jname, *nname; + char *dot, *ep, *jname; int c, i, jflags, jid, lastjid, pflags, spc; jname = NULL; @@ -139,17 +139,14 @@ main(int argc, char **argv) JP_USER); if (pflags & PRINT_SKIP) { - /* Check for parameters with boolean parents. */ + /* Check for parameters with jailsys parents. */ for (i = 0; i < nparams; i++) { if ((params[i].jp_flags & JP_USER) && (dot = strchr(params[i].jp_name, '.'))) { *dot = 0; - nname = noname(params[i].jp_name); + param_parent[i] = add_param(params[i].jp_name, + NULL, (size_t)0, NULL, JP_OPT); *dot = '.'; - param_noparent[i] = - add_param(nname, NULL, (size_t)0, NULL, - JP_OPT); - free(nname); } } } @@ -237,21 +234,20 @@ add_param(const char *name, void *value, size_t valuelen, if (!nparams) { paramlistsize = 32; params = malloc(paramlistsize * sizeof(*params)); - param_noparent = - malloc(paramlistsize * sizeof(*param_noparent)); - if (params == NULL || param_noparent == NULL) + param_parent = malloc(paramlistsize * sizeof(*param_parent)); + if (params == NULL || param_parent == NULL) err(1, "malloc"); } else if (nparams >= paramlistsize) { paramlistsize *= 2; params = realloc(params, paramlistsize * sizeof(*params)); - param_noparent = realloc(param_noparent, - paramlistsize * sizeof(*param_noparent)); - if (params == NULL || param_noparent == NULL) + param_parent = realloc(param_parent, + paramlistsize * sizeof(*param_parent)); + if (params == NULL || param_parent == NULL) err(1, "realloc"); } /* Look up the parameter. */ - param_noparent[nparams] = -1; + param_parent[nparams] = -1; param = params + nparams++; if (source != NULL) { *param = *source; @@ -387,8 +383,9 @@ print_jail(int pflags, int jflags) if ((pflags & PRINT_SKIP) && ((!(params[i].jp_ctltype & (CTLFLAG_WR | CTLFLAG_TUN))) || - (param_noparent[i] >= 0 && - *(int *)params[param_noparent[i]].jp_value))) + (param_parent[i] >= 0 && + *(int *)params[param_parent[i]].jp_value != + JAIL_SYS_NEW))) continue; if (spc) putchar(' '); |