Date: Fri, 27 Feb 2015 02:53:45 +0000 (UTC) From: Jamie Gritton <jamie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r279348 - stable/10/usr.sbin/jls Message-ID: <201502270253.t1R2rjJ4084861@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jamie Date: Fri Feb 27 02:53:44 2015 New Revision: 279348 URL: https://svnweb.freebsd.org/changeset/base/279348 Log: MFC r279083: Fix the logic for skipping parameters (with -s) that have "jailsys" parents (such as host.hostname); these were being skipped all the time. That it went this long without anyone noticing is a sign that this feature isn't actually used by anyone, but it's there so it might as well work. MFC r279123: Allow for parameters added with the JP_OPT flag to not exist. That's why the flag exists in the first place. Modified: stable/10/usr.sbin/jls/jls.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/jls/jls.c ============================================================================== --- stable/10/usr.sbin/jls/jls.c Fri Feb 27 02:50:01 2015 (r279347) +++ stable/10/usr.sbin/jls/jls.c Fri Feb 27 02:53:44 2015 (r279348) @@ -78,7 +78,7 @@ static void quoted_print(char *str); int main(int argc, char **argv) { - char *dot, *ep, *jname; + char *dot, *ep, *jname, *pname; int c, i, jflags, jid, lastjid, pflags, spc; jname = NULL; @@ -178,10 +178,11 @@ main(int argc, char **argv) for (i = 0; i < nparams; i++) { if ((params[i].jp_flags & JP_USER) && (dot = strchr(params[i].jp_name, '.'))) { - *dot = 0; - param_parent[i] = add_param(params[i].jp_name, + pname = alloca((dot - params[i].jp_name) + 1); + strlcpy(pname, params[i].jp_name, + (dot - params[i].jp_name) + 1); + param_parent[i] = add_param(pname, NULL, (size_t)0, NULL, JP_OPT); - *dot = '.'; } } } @@ -293,10 +294,8 @@ add_param(const char *name, void *value, param->jp_flags |= flags; return param - params; } - if (jailparam_init(param, name) < 0) - errx(1, "%s", jail_errmsg); - param->jp_flags = flags; - if ((value != NULL ? jailparam_import_raw(param, value, valuelen) + if (jailparam_init(param, name) < 0 || + (value != NULL ? jailparam_import_raw(param, value, valuelen) : jailparam_import(param, value)) < 0) { if (flags & JP_OPT) { nparams--; @@ -304,6 +303,7 @@ add_param(const char *name, void *value, } errx(1, "%s", jail_errmsg); } + param->jp_flags = flags; return param - params; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502270253.t1R2rjJ4084861>