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 ||
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to