Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Feb 2013 03:46:16 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
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
Message-ID:  <201302030346.r133kGQ8018102@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <unistd.h>
 #include <fcntl.h>
 #include <err.h>
+#include <errno.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -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 <unistd.h>
 #include <fcntl.h>
 #include <err.h>
+#include <errno.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -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;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302030346.r133kGQ8018102>