047bcb8e7d37847b96dbf621ea22ff00e9541d32 makes ls valgrind-clean, but only with CFG_TOYBOX_DEBUG. Turning that on enables printf argument checking, which breaks the build for Android because of the tree-wide enforcement of -Werror=format-security. --- lib/xwrap.c | 2 +- toys/other/bzcat.c | 4 ++-- toys/other/hexedit.c | 2 +- toys/other/stat.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
-- Elliott Hughes - http://who/enh - http://jessies.org/~enh/ Android native code/tools questions? Mail me/drop by/add me as a reviewer.
From 2d994132452820ff97865dce661102e0b35926f0 Mon Sep 17 00:00:00 2001 From: Elliott Hughes <[email protected]> Date: Mon, 4 Jan 2016 14:09:19 -0800 Subject: [PATCH] Fix -Wformat-security errors. 047bcb8e7d37847b96dbf621ea22ff00e9541d32 makes ls valgrind-clean, but only with CFG_TOYBOX_DEBUG. Turning that on enables printf argument checking, which breaks the build for Android because of the tree-wide enforcement of -Werror=format-security. --- lib/xwrap.c | 2 +- toys/other/bzcat.c | 4 ++-- toys/other/hexedit.c | 2 +- toys/other/stat.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/xwrap.c b/lib/xwrap.c index 6d0c511..d58ac84 100644 --- a/lib/xwrap.c +++ b/lib/xwrap.c @@ -214,7 +214,7 @@ pid_t xpopen_both(char **argv, int *pipes) // setting high bit of argv[0][0] to let new process know **toys.argv |= 0x80; execv(s, toys.argv); - perror_msg(s); + perror_msg("%s", s); _exit(127); } diff --git a/toys/other/bzcat.c b/toys/other/bzcat.c index 850c51c..93a50ac 100644 --- a/toys/other/bzcat.c +++ b/toys/other/bzcat.c @@ -663,7 +663,7 @@ static void do_bzcat(int fd, char *name) { char *err = bunzipStream(fd, 1); - if (err) error_exit(err); + if (err) error_exit("%s", err); } void bzcat_main(void) @@ -700,7 +700,7 @@ static void do_bunzip2(int fd, char *name) if (toys.optflags&FLAG_v) { printf("%s\n", err ? err : "ok"); toys.exitval |= !!err; - } else if (err) error_msg(err); + } else if (err) error_msg("%s", err); // can't test outfd==1 because may have been called with stdin+stdout closed if (rename) { diff --git a/toys/other/hexedit.c b/toys/other/hexedit.c index b3bde2e..c45ef1c 100644 --- a/toys/other/hexedit.c +++ b/toys/other/hexedit.c @@ -173,7 +173,7 @@ void hexedit_main(void) // Display cursor and flush output highlight(x, y, ro ? 3 : side); - xprintf(""); + xflush(); // Wait for next key key = scan_key(keybuf, 1); diff --git a/toys/other/stat.c b/toys/other/stat.c index fe522b0..ecaa486 100644 --- a/toys/other/stat.c +++ b/toys/other/stat.c @@ -129,7 +129,7 @@ static void print_statfs(char type) { for (i=0; i<ARRAY_LEN(nn); i++) if (nn[i].num == statfs->f_type) s = nn[i].name; - xprintf(s); + xprintf("%s", s); } else if (type == 'i') xprintf("%08x%08x", statfs->f_fsid.__val[0], statfs->f_fsid.__val[1]); else if (type == 's') xprintf("%d", statfs->f_frsize); -- 2.6.0.rc2.230.g3dd15c0
_______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
