From owner-svn-src-head@FreeBSD.ORG Thu Sep 25 22:47:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 98EF9D17; Thu, 25 Sep 2014 22:47:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84E72C76; Thu, 25 Sep 2014 22:47:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8PMlKTQ046313; Thu, 25 Sep 2014 22:47:20 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8PMlKMM046312; Thu, 25 Sep 2014 22:47:20 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201409252247.s8PMlKMM046312@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 25 Sep 2014 22:47:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272145 - head/sbin/sysctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Sep 2014 22:47:20 -0000 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 ||