svn commit: r272145 - head/sbin/sysctl

Xin LI delphij at FreeBSD.org
Thu Sep 25 22:47:20 UTC 2014


Author: delphij
Date: Thu Sep 25 22:47:19 2014
New Revision: 272145
URL: http://svnweb.freebsd.org/changeset/base/272145

Log:
  Explicitly set errno to 0 before calling strto*.
  
  Suggested by:	mjg
  MFC after:	2 weeks

Modified:
  head/sbin/sysctl/sysctl.c

Modified: head/sbin/sysctl/sysctl.c
==============================================================================
--- head/sbin/sysctl/sysctl.c	Thu Sep 25 22:37:27 2014	(r272144)
+++ head/sbin/sysctl/sysctl.c	Thu Sep 25 22:47:19 2014	(r272145)
@@ -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 ||


More information about the svn-src-head mailing list