dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

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

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