Author: jamie
Date: Fri Feb 20 20:12:05 2015
New Revision: 279083
URL: https://svnweb.freebsd.org/changeset/base/279083

Log:
  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

Modified:
  head/usr.sbin/jls/jls.c

Modified: head/usr.sbin/jls/jls.c
==============================================================================
--- head/usr.sbin/jls/jls.c     Fri Feb 20 20:02:47 2015        (r279082)
+++ head/usr.sbin/jls/jls.c     Fri Feb 20 20:12:05 2015        (r279083)
@@ -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 = '.';
                        }
                }
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to