svn commit: r246281 - stable/9/usr.sbin/cpucontrol

Eitan Adler eadler at FreeBSD.org
Sun Feb 3 03:46:17 UTC 2013


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;
 	}


More information about the svn-src-stable-9 mailing list