diff options
author | eadler <eadler@FreeBSD.org> | 2013-01-16 05:00:51 +0000 |
---|---|---|
committer | eadler <eadler@FreeBSD.org> | 2013-01-16 05:00:51 +0000 |
commit | 01b3f1d63526dfaa1fb71e71019fb3772c6f86f2 (patch) | |
tree | 6e79ced41d9c0baec837c41407f8c04ddab6a282 /usr.sbin/cpucontrol | |
parent | 40c33626ef547f26a97f80a5032fc062dce202a9 (diff) | |
download | FreeBSD-src-01b3f1d63526dfaa1fb71e71019fb3772c6f86f2.zip FreeBSD-src-01b3f1d63526dfaa1fb71e71019fb3772c6f86f2.tar.gz |
Avoid clobbering errno with a call to fprintf
PR: bin/173923
Submitted by: Garrett Cooper <yanegomi@gmail.com>
Approved by: cperciva
MFC After: 3 days
Diffstat (limited to 'usr.sbin/cpucontrol')
-rw-r--r-- | usr.sbin/cpucontrol/intel.c | 3 | ||||
-rw-r--r-- | usr.sbin/cpucontrol/via.c | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/usr.sbin/cpucontrol/intel.c b/usr.sbin/cpucontrol/intel.c index 15ac939..96ab704 100644 --- a/usr.sbin/cpucontrol/intel.c +++ b/usr.sbin/cpucontrol/intel.c @@ -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; } diff --git a/usr.sbin/cpucontrol/via.c b/usr.sbin/cpucontrol/via.c index 71ae406..d17e31f 100644 --- a/usr.sbin/cpucontrol/via.c +++ b/usr.sbin/cpucontrol/via.c @@ -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> @@ -203,7 +204,9 @@ via_update(const char *dev, const char *path) 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; } |