From owner-svn-src-stable-9@FreeBSD.ORG Sun Feb 3 03:46:16 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EA708EDB; Sun, 3 Feb 2013 03:46:16 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D8D03307; Sun, 3 Feb 2013 03:46:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r133kGS8018106; Sun, 3 Feb 2013 03:46:16 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r133kGQ8018102; Sun, 3 Feb 2013 03:46:16 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201302030346.r133kGQ8018102@svn.freebsd.org> From: Eitan Adler Date: Sun, 3 Feb 2013 03:46:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246281 - stable/9/usr.sbin/cpucontrol X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 03:46:17 -0000 Author: eadler Date: Sun Feb 3 03:46:16 2013 New Revision: 246281 URL: http://svnweb.freebsd.org/changeset/base/246281 Log: MFC r245491: Avoid clobbering errno with a call to fprintf PR: bin/173923 Approved by: cperciva (mentor, implicit) Modified: stable/9/usr.sbin/cpucontrol/intel.c stable/9/usr.sbin/cpucontrol/via.c Directory Properties: stable/9/usr.sbin/cpucontrol/ (props changed) Modified: stable/9/usr.sbin/cpucontrol/intel.c ============================================================================== --- stable/9/usr.sbin/cpucontrol/intel.c Sun Feb 3 03:43:59 2013 (r246280) +++ stable/9/usr.sbin/cpucontrol/intel.c Sun Feb 3 03:46:16 2013 (r246281) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -266,7 +267,9 @@ matched: args.size = data_size; error = ioctl(devfd, CPUCTL_UPDATE, &args); if (error < 0) { + error = errno; fprintf(stderr, "failed.\n"); + errno = error; WARN(0, "ioctl()"); goto fail; } Modified: stable/9/usr.sbin/cpucontrol/via.c ============================================================================== --- stable/9/usr.sbin/cpucontrol/via.c Sun Feb 3 03:43:59 2013 (r246280) +++ stable/9/usr.sbin/cpucontrol/via.c Sun Feb 3 03:46:16 2013 (r246281) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -204,7 +205,9 @@ via_update(const char *dev, const char * args.size = data_size; error = ioctl(devfd, CPUCTL_UPDATE, &args); if (error < 0) { + error = errno; fprintf(stderr, "failed.\n"); + errno = error; WARN(0, "ioctl()"); goto fail; }