diff options
author | jamie <jamie@FreeBSD.org> | 2015-02-20 20:12:05 +0000 |
---|---|---|
committer | jamie <jamie@FreeBSD.org> | 2015-02-20 20:12:05 +0000 |
commit | f96d8bab7736869bf1316f1db202ebc9d615a73b (patch) | |
tree | 808475b5f1f0bfadc9acead3c86cf89fd77e3d78 /usr.sbin | |
parent | 88d59e6fb36ce42986854e23d27610cbccbf9b45 (diff) | |
download | FreeBSD-src-f96d8bab7736869bf1316f1db202ebc9d615a73b.zip FreeBSD-src-f96d8bab7736869bf1316f1db202ebc9d615a73b.tar.gz |
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 after: 1 week
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/jls/jls.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/jls/jls.c b/usr.sbin/jls/jls.c index 3bcc566..8e5512d 100644 --- a/usr.sbin/jls/jls.c +++ b/usr.sbin/jls/jls.c @@ -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 = '.'; } } } |