summaryrefslogtreecommitdiffstats
path: root/sbin/sysctl
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2014-09-25 22:47:19 +0000
committerdelphij <delphij@FreeBSD.org>2014-09-25 22:47:19 +0000
commitf092aede042fe87087d30a12337a30af2f600287 (patch)
treea43c374a05ea5a975bff89c8ee7d3bd42c21216a /sbin/sysctl
parentd8ef9b3342dce9245e3438162b0c68f65e684155 (diff)
downloadFreeBSD-src-f092aede042fe87087d30a12337a30af2f600287.zip
FreeBSD-src-f092aede042fe87087d30a12337a30af2f600287.tar.gz
Explicitly set errno to 0 before calling strto*.
Suggested by: mjg MFC after: 2 weeks
Diffstat (limited to 'sbin/sysctl')
-rw-r--r--sbin/sysctl/sysctl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index d7fe8e9..5ebec28 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -294,6 +294,8 @@ parse(const char *string, int lineno)
}
}
+ errno = 0;
+
switch (kind & CTLTYPE) {
case CTLTYPE_INT:
if (strcmp(fmt, "IK") == 0) {
@@ -673,6 +675,7 @@ set_IK(const char *str, int *val)
if ((len = strlen(str)) == 0)
return (0);
p = &str[len - 1];
+ errno = 0;
if (*p == 'C' || *p == 'F') {
temp = strtof(str, &endptr);
if (errno != 0 || endptr == str ||
OpenPOWER on IntegriCloud