summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2015-10-07 08:56:01 +0000
committerbapt <bapt@FreeBSD.org>2015-10-07 08:56:01 +0000
commit198f362e320ac36fa16f2544e295d847aedf3122 (patch)
tree82d21966105ec00808cc7a5b2e2c8853d8142600 /sbin
parent03da536d33769b512a0f954475624ef1ecbee8bd (diff)
downloadFreeBSD-src-198f362e320ac36fa16f2544e295d847aedf3122.zip
FreeBSD-src-198f362e320ac36fa16f2544e295d847aedf3122.tar.gz
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 MFC after: 1 week Sponsored by: Gandi.net
Diffstat (limited to 'sbin')
-rw-r--r--sbin/sysctl/sysctl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index d740778c..8d67644 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -262,6 +262,12 @@ parse(const char *string, int lineno)
newvalstr = 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) {
OpenPOWER on IntegriCloud