summaryrefslogtreecommitdiffstats
path: root/sys-utils
diff options
context:
space:
mode:
authorPetr Uzel2011-09-22 12:12:37 +0200
committerKarel Zak2011-09-27 15:46:07 +0200
commit960cf5737e58c03b0d29797c0d4bd3461f1fdeff (patch)
tree10cc302358d2ffa6673010b3e8cebbb924570ab6 /sys-utils
parentdocs: update TODO (diff)
downloadkernel-qcow2-util-linux-960cf5737e58c03b0d29797c0d4bd3461f1fdeff.tar.gz
kernel-qcow2-util-linux-960cf5737e58c03b0d29797c0d4bd3461f1fdeff.tar.xz
kernel-qcow2-util-linux-960cf5737e58c03b0d29797c0d4bd3461f1fdeff.zip
misc: use %m in format string instead of %s and strerror(errno)
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Diffstat (limited to 'sys-utils')
-rw-r--r--sys-utils/chcpu.c12
-rw-r--r--sys-utils/readprofile.c8
2 files changed, 8 insertions, 12 deletions
diff --git a/sys-utils/chcpu.c b/sys-utils/chcpu.c
index 2cf015fb4..475c1cec6 100644
--- a/sys-utils/chcpu.c
+++ b/sys-utils/chcpu.c
@@ -96,8 +96,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
printf(_("CPU %d enable failed "
"(CPU is deconfigured)\n"), cpu);
else if (rc == -1)
- printf(_("CPU %d enable failed (%s)\n"), cpu,
- strerror(errno));
+ printf(_("CPU %d enable failed (%m)\n"), cpu);
else
printf(_("CPU %d enabled\n"), cpu);
} else {
@@ -108,8 +107,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
}
rc = path_writestr("0", _PATH_SYS_CPU "/cpu%d/online", cpu);
if (rc == -1)
- printf(_("CPU %d disable failed (%s)\n"), cpu,
- strerror(errno));
+ printf(_("CPU %d disable failed (%m)\n"), cpu);
else {
printf(_("CPU %d disabled\n"), cpu);
if (onlinecpus)
@@ -181,15 +179,13 @@ static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure)
if (configure) {
rc = path_writestr("1", _PATH_SYS_CPU "/cpu%d/configure", cpu);
if (rc == -1)
- printf(_("CPU %d configure failed (%s)\n"), cpu,
- strerror(errno));
+ printf(_("CPU %d configure failed (%m)\n"), cpu);
else
printf(_("CPU %d configured\n"), cpu);
} else {
rc = path_writestr("0", _PATH_SYS_CPU "/cpu%d/configure", cpu);
if (rc == -1)
- printf(_("CPU %d deconfigure failed (%s)\n"), cpu,
- strerror(errno));
+ printf(_("CPU %d deconfigure failed (%m)\n"), cpu);
else
printf(_("CPU %d deconfigured\n"), cpu);
}
diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c
index 0e124bc71..49f0cbd6c 100644
--- a/sys-utils/readprofile.c
+++ b/sys-utils/readprofile.c
@@ -211,8 +211,8 @@ main(int argc, char **argv) {
exit(1);
}
if (write(fd, &multiplier, to_write) != to_write) {
- fprintf(stderr, _("readprofile: error writing %s: %s\n"),
- defaultpro, strerror(errno));
+ fprintf(stderr, _("readprofile: error writing %s: %m\n"),
+ defaultpro);
exit(1);
}
close(fd);
@@ -225,7 +225,7 @@ main(int argc, char **argv) {
if (((proFd=open(proFile,O_RDONLY)) < 0)
|| ((int)(len=lseek(proFd,0,SEEK_END)) < 0)
|| (lseek(proFd,0,SEEK_SET) < 0)) {
- fprintf(stderr,"%s: %s: %s\n",prgname,proFile,strerror(errno));
+ fprintf(stderr,"%s: %s: %m\n", prgname, proFile);
exit(1);
}
@@ -233,7 +233,7 @@ main(int argc, char **argv) {
rc = read(proFd,buf,len);
if (rc < 0 || (size_t) rc != len) {
- fprintf(stderr,"%s: %s: %s\n",prgname,proFile,strerror(errno));
+ fprintf(stderr,"%s: %s: %m\n", prgname, proFile);
exit(1);
}
close(proFd);