svn commit: r275377 - head/sbin/sysctl

Xin LI delphij at FreeBSD.org
Mon Dec 1 20:51:02 UTC 2014


Author: delphij
Date: Mon Dec  1 20:51:01 2014
New Revision: 275377
URL: https://svnweb.freebsd.org/changeset/base/275377

Log:
  Fix inverted logic introduced in r272154.
  
  Noticed by:	trasz
  MFC after:	2 weeks

Modified:
  head/sbin/sysctl/sysctl.c

Modified: head/sbin/sysctl/sysctl.c
==============================================================================
--- head/sbin/sysctl/sysctl.c	Mon Dec  1 19:48:23 2014	(r275376)
+++ head/sbin/sysctl/sysctl.c	Mon Dec  1 20:51:01 2014	(r275377)
@@ -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;


More information about the svn-src-head mailing list