svn commit: r289291 - stable/10/sbin/sysctl

Baptiste Daroussin bapt at FreeBSD.org
Wed Oct 14 06:26:56 UTC 2015


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) {


More information about the svn-src-stable-10 mailing list