Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Oct 2015 06:26:55 +0000 (UTC)
From:      Baptiste Daroussin <bapt@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: r289291 - stable/10/sbin/sysctl
Message-ID:  <201510140626.t9E6QtgK035776@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510140626.t9E6QtgK035776>