mirror of
https://github.com/troglobit/finit.git
synced 2026-11-18 19:30:56 +00:00
initctl: Fix possible divide by zero, found by Coverity Scan
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
921fd1e363
commit
11dd877484
1 file changed
+3
@@ -86,6 +86,9 @@ static void do_list(const char *heading, const char *path)
|
|||||||
printf("\e[1m%s\e[0m\n", buf);
|
printf("\e[1m%s\e[0m\n", buf);
|
||||||
|
|
||||||
width = calc_width(gl.gl_pathv, gl.gl_pathc);
|
width = calc_width(gl.gl_pathv, gl.gl_pathc);
|
||||||
|
if (width <= 0)
|
||||||
|
goto done;
|
||||||
|
|
||||||
num = (screen_cols - 2) / width;
|
num = (screen_cols - 2) / width;
|
||||||
if ((num - 1) * 2 + num * width > screen_cols)
|
if ((num - 1) * 2 + num * width > screen_cols)
|
||||||
num--;
|
num--;
|
||||||
|
|||||||
Reference in new issue
Block a user