aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-12-26 19:39:51 -0600
committerRob Landley <rob@landley.net>2012-12-26 19:39:51 -0600
commitf02ca1e5d07157b66fde51068881611ab44cce68 (patch)
tree2ac06d4290cbe77abdbc11b153c4d19bb62cbfdc /toys
parent27cec9ac4ca6c207ea7e74e109e362659f8dfeeb (diff)
downloadtoybox-f02ca1e5d07157b66fde51068881611ab44cce68.tar.gz
A screen width of 1 is possible (in some weird setups), and gives ls -C a division by zero error.
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/ls.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/toys/posix/ls.c b/toys/posix/ls.c
index cd881b05..5982adfe 100644
--- a/toys/posix/ls.c
+++ b/toys/posix/ls.c
@@ -425,6 +425,7 @@ void ls_main(void)
else {
TT.screen_width = 80;
terminal_size(&TT.screen_width, NULL);
+ if (TT.screen_width<2) TT.screen_width = 2;
if (!(toys.optflags&(FLAG_1|FLAG_x|FLAG_m))) toys.optflags |= FLAG_C;
}
// The optflags parsing infrastructure should really do this for us,