Fix inverted logic introduced in r272154.
Noticed by: trasz MFC after: 2 weeks
This commit is contained in:
parent
afe2c75694
commit
689c8e8b46
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=275377
@ -679,15 +679,18 @@ strIKtoi(const char *str, char **endptrp)
|
|||||||
p = &str[len - 1];
|
p = &str[len - 1];
|
||||||
if (*p == 'C' || *p == 'F') {
|
if (*p == 'C' || *p == 'F') {
|
||||||
temp = strtof(str, endptrp);
|
temp = strtof(str, endptrp);
|
||||||
if (*endptrp != str && *endptrp == p && errno != 0) {
|
if (*endptrp != str && *endptrp == p && errno == 0) {
|
||||||
if (*p == 'F')
|
if (*p == 'F')
|
||||||
temp = (temp - 32) * 5 / 9;
|
temp = (temp - 32) * 5 / 9;
|
||||||
|
*endptrp = NULL;
|
||||||
return (temp * 10 + 2732);
|
return (temp * 10 + 2732);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
kelv = (int)strtol(str, endptrp, 10);
|
kelv = (int)strtol(str, endptrp, 10);
|
||||||
if (*endptrp != str && *endptrp == p && errno != 0)
|
if (*endptrp != str && *endptrp == p && errno == 0) {
|
||||||
|
*endptrp = NULL;
|
||||||
return (kelv);
|
return (kelv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
errno = ERANGE;
|
errno = ERANGE;
|
||||||
|
Loading…
Reference in New Issue
Block a user