summaryrefslogtreecommitdiff
path: root/src/bin/tyls.c
diff options
context:
space:
mode:
authorStefan Schmidt <stefan@datenfreihafen.org>2014-01-30 13:19:19 +0100
committerBoris Faure <billiob@gmail.com>2014-02-26 21:14:50 +0100
commitf1deb3ca3e5ebed830d745603cda6993d5b0186f (patch)
treead161937cf41e48e2e1e8a8cb2f7a0d25c2b4bd3 /src/bin/tyls.c
parentd1810ed034156a45c518a122f525f5a39aef5cae (diff)
tyls: Make sure we never divide by zero
Avoid the case where cols is 0 and we divide through it. CID 1100655
Diffstat (limited to 'src/bin/tyls.c')
-rw-r--r--src/bin/tyls.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/bin/tyls.c b/src/bin/tyls.c
index 82ef6c7..d046163 100644
--- a/src/bin/tyls.c
+++ b/src/bin/tyls.c
@@ -640,6 +640,7 @@ list_dir(const char *dir, int mode)
640 stuff--; 640 stuff--;
641 } 641 }
642 if (cols > num) cols = num; 642 if (cols > num) cols = num;
643 if (cols == 0) cols = 1;
643 rows = ((num + (cols - 1)) / cols); 644 rows = ((num + (cols - 1)) / cols);
644 for (i = 0; i < rows; i++) 645 for (i = 0; i < rows; i++)
645 { 646 {