Author: bapt
Date: Wed Oct 14 06:26:55 2015
New Revision: 289291
URL: https://svnweb.freebsd.org/changeset/base/289291

Log:
  Trim spaces at the end of the buffer before trying to convert it to an oid
  
  This allows to write entries in sysctl.conf with spaces before the '=' like
  kern.ipc.shmmax = 9663676416
  
  Sponsored by: Gandi.net

Modified:
  stable/10/sbin/sysctl/sysctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/sysctl/sysctl.c
==============================================================================
--- stable/10/sbin/sysctl/sysctl.c      Wed Oct 14 06:24:01 2015        
(r289290)
+++ stable/10/sbin/sysctl/sysctl.c      Wed Oct 14 06:26:55 2015        
(r289291)
@@ -233,6 +233,12 @@ parse(const char *string, int lineno)
                newval = cp;
                newsize = strlen(cp);
        }
+       /* Trim spaces */
+       cp = bufp + strlen(bufp) - 1;
+       while (cp >= bufp && isspace((int)*cp)) {
+               *cp = '\0';
+               cp--;
+       }
        len = name2oid(bufp, mib);
 
        if (len < 0) {
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to