From f02ca1e5d07157b66fde51068881611ab44cce68 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 26 Dec 2012 19:39:51 -0600 Subject: A screen width of 1 is possible (in some weird setups), and gives ls -C a division by zero error. --- toys/posix/ls.c | 1 + 1 file changed, 1 insertion(+) 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, -- cgit v1.2.3