i'll be AFK for a week, so here's the patch i've been using this
evening to find other format string mistakes. BSD uses __printflike
and takes two arguments instead of hard-coding (1,2), but i figured
that as long as you don't need the generality you'd prefer not to have
it. and it's easy enough to
diff --git a/toys/posix/cp.c b/toys/posix/cp.c
index 3dc6f2a..45c93e7 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, ' ',
%o is unsigned, but off_t is signed.
* takes an int.
an error_msg call was missing an argument.
only one of these is an actual error, but i'd like to fix the others
too so that we (toybox, but if not, then Android) can turn on format
string warnings to prevent future bugs like the stat.c LP32 ones
diff --git a/toys/posix/df.c b/toys/posix/df.c
index 141e8e5..dfc0f25 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\tUse
diff --git a/toys/other/ifconfig.c b/toys/other/ifconfig.c
index 8db3ff0..31fc1d3 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) xp
the ' ' flag doesn't mean anything for unsigned conversions.
diff --git a/toys/posix/ls.c b/toys/posix/ls.c
index d1a26ee..a924137 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 (fla
diff --git a/toys/other/sysctl.c b/toys/other/sysctl.c
index 8e57ca1..3c12058 100644
--- a/toys/other/sysctl.c
+++ b/toys/other/sysctl.c
@@ -97,8 +97,7 @@ static void process_key(char *key, char *value)
if (!value) value = split_key(key);
if ((toys.optflags & FLAG_w) && !value) {
-error_
diff --git a/toys/posix/ln.c b/toys/posix/ln.c
index 04b4f29..06700dd 100644
--- a/toys/posix/ln.c
+++ b/toys/posix/ln.c
@@ -40,7 +40,7 @@ void ln_main(void)
if (((toys.optflags&FLAG_n) ? lstat : stat)(dest, &buf)
|| !S_ISDIR(buf.st_mode))
{
-if (toys.optc>1) error_exit("'%s' not a d
diff --git a/toys/lsb/mount.c b/toys/lsb/mount.c
index c334681..f8c25e3 100644
--- a/toys/lsb/mount.c
+++ b/toys/lsb/mount.c
@@ -144,7 +144,7 @@ static void mount_filesystem(char *dev, char *dir,
char *type,
if (getuid()) {
if (TT.okuser) TT.okuser = 0;
else {
- error_msg("'%s' no
diff --git a/lib/xwrap.c b/lib/xwrap.c
index 0a2b38f..14703a7 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -24,7 +24,7 @@ void xstrncat(char *dest, char *src, size_t size)
long len = strlen(src);
if (len+strlen(dest)+1 > size)
-error_exit("'%s%s' > %ld bytes", src, (long)size);
+err
the ' ' flag makes no sense for %c.
diff --git a/toys/posix/split.c b/toys/posix/split.c
index d9a556b..aabf931 100644
--- a/toys/posix/split.c
+++ b/toys/posix/split.c
@@ -100,7 +100,7 @@ void split_main(void)
if (!TT.bytes && !TT.lines) TT.lines = 1000;
// Allocate template for output fil
On Wed, Feb 25, 2015 at 03:19:23AM -0600, Rob Landley wrote:
> There's a marvelous book called "the unix philosophy" by mike gancarz
> that talks about output intended for humans vs output intended to be
> processed by other tools.
>
> A scriptable tool is one where you can do:
>
> echo $(( $(w
Hi.
I have a question about ifconfig.
Nov 30 on 2013, Rob deleted "trailers" and "dynamic" options because they
are dead fields unused by linux kernel.
But, "NOTRAILERS" and "DYNAMIC" string still exist in the code, line
from 212 to 214 in ifconfig.c
I think these also should be removed if really
On 02/25/2015 02:09 AM, James McMechan wrote:
> Is there some reason you don't want to use the --output option? not in posix?
>
> # df / --output=avail
>Avail
> 10291956
1) Not in posix
2) Not yet implemented in toybox (because nothing I've tried uses it, so
I'd be adding a dependency on an
Is there some reason you don't want to use the --output option? not in posix?
# df / --output=avail
Avail
10291956
> Date: Tue, 24 Feb 2015 13:46:07 -0600
> From: r...@landley.net
> To: toybox@lists.landley.net
> Subject: [Toybox] I aten't dead.
>
>
15 matches
Mail list logo