summaryrefslogtreecommitdiffstats
path: root/sys-utils/dmesg.c
diff options
context:
space:
mode:
authorSami Kerola2015-03-23 00:05:26 +0100
committerKarel Zak2015-03-23 10:34:49 +0100
commitf1300e2cea31d6232783dafb97b7c600d48823e8 (patch)
tree09724195930e1a652a7e0effd44121475fbcedee /sys-utils/dmesg.c
parentunshare: add --propagation, use MS_PRIVATE by default (diff)
downloadkernel-qcow2-util-linux-f1300e2cea31d6232783dafb97b7c600d48823e8.tar.gz
kernel-qcow2-util-linux-f1300e2cea31d6232783dafb97b7c600d48823e8.tar.xz
kernel-qcow2-util-linux-f1300e2cea31d6232783dafb97b7c600d48823e8.zip
dmesg: fix shadow declaration
sys-utils/dmesg.c:650:9: warning: declaration of 's' shadows a previous local [-Wshadow] sys-utils/dmesg.c:619:12: warning: shadowed declaration is here [-Wshadow] And since the code had to be touched deprecate loop printing one character at a time, in favour of printf and instruction to repeat spaces the number required. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/dmesg.c')
-rw-r--r--sys-utils/dmesg.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index 5a6ee41d9..b56199f36 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -614,7 +614,6 @@ static int fwrite_hex(const char *buf, size_t size, FILE *out)
static void safe_fwrite(const char *buf, size_t size, int indent, FILE *out)
{
size_t i;
- int in;
#ifdef HAVE_WIDECHAR
mbstate_t s;
memset(&s, 0, sizeof (s));
@@ -647,13 +646,9 @@ static void safe_fwrite(const char *buf, size_t size, int indent, FILE *out)
if (hex)
rc = fwrite_hex(p, len, out);
else if (*p == '\n' && *(p + 1) && indent) {
- char s = ' ';
- rc = fwrite(p, 1, len, out) != len;
- in = indent;
- do {
- if (!rc) rc = fwrite(&s, 1, 1, out) != 1;
- in--;
- } while (in && !rc);
+ rc = fwrite(p, 1, len, out) != len;
+ if (fprintf(out, "%*s", indent, "") != indent)
+ rc |= 1;
}
else
rc = fwrite(p, 1, len, out) != len;