From 30c36d87280f3c45db157056b94ff67922f03fbf Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 1 Mar 2015 16:08:51 -0600 Subject: Patches from Elliott Hughes to fix various printf() format strings. (Don't specify the space flag when it's the default behavior. The ifconfig stuff was actual bugs.) --- toys/other/ifconfig.c | 4 ++-- toys/posix/cp.c | 2 +- toys/posix/df.c | 2 +- toys/posix/ls.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'toys') diff --git a/toys/other/ifconfig.c b/toys/other/ifconfig.c index 8db3ff06..31fc1d3c 100644 --- a/toys/other/ifconfig.c +++ b/toys/other/ifconfig.c @@ -254,7 +254,7 @@ static void display_ifconfig(char *name, int always, unsigned long long val[]) xprintf("%10c", ' '); if(ifre.ifr_map.irq) xprintf("Interrupt:%d ", ifre.ifr_map.irq); if(ifre.ifr_map.base_addr >= 0x100) // IO_MAP_INDEX - xprintf("Base address:0x%lx ", ifre.ifr_map.base_addr); + xprintf("Base address:0x%x ", ifre.ifr_map.base_addr); if(ifre.ifr_map.mem_start) xprintf("Memory:%lx-%lx ", ifre.ifr_map.mem_start, ifre.ifr_map.mem_end); if(ifre.ifr_map.dma) xprintf("DMA chan:%x ", ifre.ifr_map.dma); @@ -449,7 +449,7 @@ void ifconfig_main(void) if (!argv[1]) { toys.exithelp++; - error_exit(*argv); + error_exit("%s", *argv); } plen = get_addrinfo(argv[1], AF_INET6, &ifre6.addr); diff --git a/toys/posix/cp.c b/toys/posix/cp.c index 3dc6f2ac..45c93e79 100644 --- a/toys/posix/cp.c +++ b/toys/posix/cp.c @@ -208,7 +208,7 @@ int cp_node(struct dirtree *try) if (*or->name == '/') dotdots = 0; if (dotdots) { - char *s2 = xmprintf("% *c%s", 3*dotdots, ' ', s); + char *s2 = xmprintf("%*c%s", 3*dotdots, ' ', s); free(s); s = s2; while(dotdots--) { diff --git a/toys/posix/df.c b/toys/posix/df.c index 141e8e50..dfc0f25f 100644 --- a/toys/posix/df.c +++ b/toys/posix/df.c @@ -86,7 +86,7 @@ void df_main(void) // Units are 512 bytes if you select "pedantic" without "kilobytes". TT.units = p ? 512 : 1024; - xprintf("Filesystem% 8s-blocks\tUsed Available %s Mounted on\n", + xprintf("Filesystem%8s-blocks\tUsed Available %s Mounted on\n", p ? "512" : "1K", p ? "Capacity" : "Use%"); if (!(mtstart = xgetmountlist(0))) return; diff --git a/toys/posix/ls.c b/toys/posix/ls.c index d1a26ee1..a9241379 100644 --- a/toys/posix/ls.c +++ b/toys/posix/ls.c @@ -375,8 +375,8 @@ static void listfiles(int dirfd, struct dirtree *indir) } width += *len; - if (flags & FLAG_i) xprintf("% *lu ", len[1], (unsigned long)st->st_ino); - if (flags & FLAG_s) xprintf("% *lu ", len[6], (unsigned long)st->st_blocks); + if (flags & FLAG_i) xprintf("%*lu ", len[1], (unsigned long)st->st_ino); + if (flags & FLAG_s) xprintf("%*lu ", len[6], (unsigned long)st->st_blocks); if (flags & (FLAG_l|FLAG_o|FLAG_n|FLAG_g)) { struct tm *tm; -- cgit v1.2.3