summaryrefslogtreecommitdiffstats
path: root/sbin/sysctl
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2014-12-01 20:51:01 +0000
committerdelphij <delphij@FreeBSD.org>2014-12-01 20:51:01 +0000
commitd70b42ed01e0ad9606399997fc3d256d77ced25c (patch)
tree16a4b7d1b9ce13a91b01f5ccfbd102a84c54f2be /sbin/sysctl
parent52b859da5fc3d395ad5479a9df0a9c5707883ca7 (diff)
downloadFreeBSD-src-d70b42ed01e0ad9606399997fc3d256d77ced25c.zip
FreeBSD-src-d70b42ed01e0ad9606399997fc3d256d77ced25c.tar.gz
Fix inverted logic introduced in r272154.
Noticed by: trasz MFC after: 2 weeks
Diffstat (limited to 'sbin/sysctl')
-rw-r--r--sbin/sysctl/sysctl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index a6ea9f9..6849b9e 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -679,15 +679,18 @@ strIKtoi(const char *str, char **endptrp)
p = &str[len - 1];
if (*p == 'C' || *p == 'F') {
temp = strtof(str, endptrp);
- if (*endptrp != str && *endptrp == p && errno != 0) {
+ if (*endptrp != str && *endptrp == p && errno == 0) {
if (*p == 'F')
temp = (temp - 32) * 5 / 9;
+ *endptrp = NULL;
return (temp * 10 + 2732);
}
} else {
kelv = (int)strtol(str, endptrp, 10);
- if (*endptrp != str && *endptrp == p && errno != 0)
+ if (*endptrp != str && *endptrp == p && errno == 0) {
+ *endptrp = NULL;
return (kelv);
+ }
}
errno = ERANGE;
OpenPOWER on IntegriCloud