diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1999-12-09 00:48:04 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1999-12-09 00:48:04 +0000 |
commit | 63046586487d686584f6870cfa9b5d62caaf1bbc (patch) | |
tree | 311f24b76304e09a9ecad212237ef92a1d24d259 /usr.bin/column/column.c | |
parent | 4a4e41a65a7a86b09131f8b781ed25f887cbb79e (diff) |
Avoid divide by zero, spotted by aaron@
Diffstat (limited to 'usr.bin/column/column.c')
-rw-r--r-- | usr.bin/column/column.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/column/column.c b/usr.bin/column/column.c index bd9a326baec..593ab3b9f92 100644 --- a/usr.bin/column/column.c +++ b/usr.bin/column/column.c @@ -1,4 +1,4 @@ -/* $OpenBSD: column.c,v 1.4 1997/06/30 11:46:21 deraadt Exp $ */ +/* $OpenBSD: column.c,v 1.5 1999/12/09 00:48:03 millert Exp $ */ /* $NetBSD: column.c,v 1.4 1995/09/02 05:53:03 jtc Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)column.c 8.4 (Berkeley) 5/4/95"; #endif -static char rcsid[] = "$OpenBSD: column.c,v 1.4 1997/06/30 11:46:21 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: column.c,v 1.5 1999/12/09 00:48:03 millert Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -174,6 +174,8 @@ r_columnate() maxlength = (maxlength + TAB) & ~(TAB - 1); numcols = termwidth / maxlength; + if (numcols == 0) + numcols = 1; numrows = entries / numcols; if (entries % numcols) ++numrows; |