summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2015-10-14 06:26:55 +0000
committerbapt <bapt@FreeBSD.org>2015-10-14 06:26:55 +0000
commit33831fe3b5010ac9dedee0fa225cf7a1c9e5d148 (patch)
tree1c9e8ef55a7d460a56a77d55ea4f029ad6db5ee1 /sbin
parentb21a2490b7db2037d72f424782390d5b5ebf82c4 (diff)
downloadFreeBSD-src-33831fe3b5010ac9dedee0fa225cf7a1c9e5d148.zip
FreeBSD-src-33831fe3b5010ac9dedee0fa225cf7a1c9e5d148.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 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 f9207f1..97628a2 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -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) {
OpenPOWER on IntegriCloud