summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Schmidt <stefan@datenfreihafen.org>2014-01-30 13:19:19 +0100
committerStefan Schmidt <stefan@datenfreihafen.org>2014-02-26 10:46:42 +0100
commit8ae31617a1826332e96320d87bf82d18ca52b35b (patch)
treedbae1819cf08f57d8632cf6e3131a7f647d8563a
parent2e95700161e9331663075d2758ca3ddc8693ed42 (diff)
tyls: Make sure we never divide by zerodevs/stefan/coverity-fixes
Avoid the case where cols is 0 and we divide through it. CID 1100655
-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 {