dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

Blame SOURCES/0171-chcpu-cleanup-stdout-stderr-usage.patch

5113bc
From 26c75797103da70f85a5fdd646625edb3eaa300c Mon Sep 17 00:00:00 2001
5113bc
From: Karel Zak <kzak@redhat.com>
5113bc
Date: Wed, 5 Mar 2014 11:23:16 +0100
5113bc
Subject: [PATCH 171/173] chcpu: cleanup stdout/stderr usage
5113bc
5113bc
Signed-off-by: Karel Zak <kzak@redhat.com>
5113bc
Upstream: http://github.com/karelzak/util-linux/commit/69e74525bb3212944feebc8c2848317e04d95ec0
5113bc
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1579439
5113bc
---
5113bc
 sys-utils/chcpu.c | 17 +++++++----------
5113bc
 1 file changed, 7 insertions(+), 10 deletions(-)
5113bc
5113bc
diff --git a/sys-utils/chcpu.c b/sys-utils/chcpu.c
5113bc
index 304b80d7a..ada0eaacc 100644
5113bc
--- a/sys-utils/chcpu.c
5113bc
+++ b/sys-utils/chcpu.c
5113bc
@@ -84,12 +84,12 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
5113bc
 		if (!CPU_ISSET(cpu, cpu_set))
5113bc
 			continue;
5113bc
 		if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) {
5113bc
-			printf(_("CPU %d does not exist\n"), cpu);
5113bc
+			warnx(_("CPU %d does not exist"), cpu);
5113bc
 			fails++;
5113bc
 			continue;
5113bc
 		}
5113bc
 		if (!path_exist(_PATH_SYS_CPU "/cpu%d/online", cpu)) {
5113bc
-			printf(_("CPU %d is not hot pluggable\n"), cpu);
5113bc
+			warnx(_("CPU %d is not hot pluggable"), cpu);
5113bc
 			fails++;
5113bc
 			continue;
5113bc
 		}
5113bc
@@ -107,8 +107,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
5113bc
 		if (enable) {
5113bc
 			rc = path_write_str("1", _PATH_SYS_CPU "/cpu%d/online", cpu);
5113bc
 			if ((rc == -1) && (configured == 0)) {
5113bc
-				warnx(_("CPU %d enable failed "
5113bc
-					 "(CPU is deconfigured)"), cpu);
5113bc
+				warn(_("CPU %d enable failed (CPU is deconfigured)"), cpu);
5113bc
 				fails++;
5113bc
 			} else if (rc == -1) {
5113bc
 				warn(_("CPU %d enable failed"), cpu);
5113bc
@@ -117,8 +116,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
5113bc
 				printf(_("CPU %d enabled\n"), cpu);
5113bc
 		} else {
5113bc
 			if (onlinecpus && num_online_cpus() == 1) {
5113bc
-				printf(_("CPU %d disable failed "
5113bc
-					 "(last enabled CPU)\n"), cpu);
5113bc
+				warnx(_("CPU %d disable failed (last enabled CPU)"), cpu);
5113bc
 				fails++;
5113bc
 				continue;
5113bc
 			}
5113bc
@@ -178,12 +176,12 @@ static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure)
5113bc
 		if (!CPU_ISSET(cpu, cpu_set))
5113bc
 			continue;
5113bc
 		if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) {
5113bc
-			printf(_("CPU %d does not exist\n"), cpu);
5113bc
+			warnx(_("CPU %d does not exist"), cpu);
5113bc
 			fails++;
5113bc
 			continue;
5113bc
 		}
5113bc
 		if (!path_exist(_PATH_SYS_CPU "/cpu%d/configure", cpu)) {
5113bc
-			printf(_("CPU %d is not configurable\n"), cpu);
5113bc
+			warnx(_("CPU %d is not configurable"), cpu);
5113bc
 			fails++;
5113bc
 			continue;
5113bc
 		}
5113bc
@@ -198,8 +196,7 @@ static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure)
5113bc
 		}
5113bc
 		if ((current == 1) && (configure == 0) && onlinecpus &&
5113bc
 		    is_cpu_online(cpu)) {
5113bc
-			printf(_("CPU %d deconfigure failed "
5113bc
-				 "(CPU is enabled)\n"), cpu);
5113bc
+			warnx(_("CPU %d deconfigure failed (CPU is enabled)"), cpu);
5113bc
 			fails++;
5113bc
 			continue;
5113bc
 		}
5113bc
-- 
5113bc
2.14.4
5113bc