diff options
author | Karel Zak | 2014-03-05 11:23:16 +0100 |
---|---|---|
committer | Karel Zak | 2014-03-05 11:23:16 +0100 |
commit | 9a7d05fedbda336270c589dfb61aba3bbb86e853 (patch) | |
tree | 5d76657ee220b0d068f1e8bb8d00819a32306d71 /sys-utils/chcpu.c | |
parent | chcpu: cleanup return codes (diff) | |
download | kernel-qcow2-util-linux-9a7d05fedbda336270c589dfb61aba3bbb86e853.tar.gz kernel-qcow2-util-linux-9a7d05fedbda336270c589dfb61aba3bbb86e853.tar.xz kernel-qcow2-util-linux-9a7d05fedbda336270c589dfb61aba3bbb86e853.zip |
chcpu: cleanup stdout/stderr usage
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/chcpu.c')
-rw-r--r-- | sys-utils/chcpu.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/sys-utils/chcpu.c b/sys-utils/chcpu.c index 304b80d7a..ada0eaacc 100644 --- a/sys-utils/chcpu.c +++ b/sys-utils/chcpu.c @@ -84,12 +84,12 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable) if (!CPU_ISSET(cpu, cpu_set)) continue; if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) { - printf(_("CPU %d does not exist\n"), cpu); + warnx(_("CPU %d does not exist"), cpu); fails++; continue; } if (!path_exist(_PATH_SYS_CPU "/cpu%d/online", cpu)) { - printf(_("CPU %d is not hot pluggable\n"), cpu); + warnx(_("CPU %d is not hot pluggable"), cpu); fails++; continue; } @@ -107,8 +107,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable) if (enable) { rc = path_write_str("1", _PATH_SYS_CPU "/cpu%d/online", cpu); if ((rc == -1) && (configured == 0)) { - warnx(_("CPU %d enable failed " - "(CPU is deconfigured)"), cpu); + warn(_("CPU %d enable failed (CPU is deconfigured)"), cpu); fails++; } else if (rc == -1) { warn(_("CPU %d enable failed"), cpu); @@ -117,8 +116,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable) printf(_("CPU %d enabled\n"), cpu); } else { if (onlinecpus && num_online_cpus() == 1) { - printf(_("CPU %d disable failed " - "(last enabled CPU)\n"), cpu); + warnx(_("CPU %d disable failed (last enabled CPU)"), cpu); fails++; continue; } @@ -178,12 +176,12 @@ static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure) if (!CPU_ISSET(cpu, cpu_set)) continue; if (!path_exist(_PATH_SYS_CPU "/cpu%d", cpu)) { - printf(_("CPU %d does not exist\n"), cpu); + warnx(_("CPU %d does not exist"), cpu); fails++; continue; } if (!path_exist(_PATH_SYS_CPU "/cpu%d/configure", cpu)) { - printf(_("CPU %d is not configurable\n"), cpu); + warnx(_("CPU %d is not configurable"), cpu); fails++; continue; } @@ -198,8 +196,7 @@ static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure) } if ((current == 1) && (configure == 0) && onlinecpus && is_cpu_online(cpu)) { - printf(_("CPU %d deconfigure failed " - "(CPU is enabled)\n"), cpu); + warnx(_("CPU %d deconfigure failed (CPU is enabled)"), cpu); fails++; continue; } |