summaryrefslogtreecommitdiffstats
path: root/usr.bin/rs/rs.c
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2001-09-10 11:56:07 +0000
committerru <ru@FreeBSD.org>2001-09-10 11:56:07 +0000
commitca7cfbacf37cb43f308beb669da1c7fac3907334 (patch)
tree791d011a0a7a85f1e81bc427447c5c7fcbd8f4b4 /usr.bin/rs/rs.c
parent8cede4f874f6deddd49e452aa0d23b5589b50e47 (diff)
downloadFreeBSD-src-ca7cfbacf37cb43f308beb669da1c7fac3907334.zip
FreeBSD-src-ca7cfbacf37cb43f308beb669da1c7fac3907334.tar.gz
Fixed SIGFPE (divide by zero) if column's width exceeds display width (-w).
Obtained from: OpenBSD
Diffstat (limited to 'usr.bin/rs/rs.c')
-rw-r--r--usr.bin/rs/rs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/rs/rs.c b/usr.bin/rs/rs.c
index ebb4238..ce5a240 100644
--- a/usr.bin/rs/rs.c
+++ b/usr.bin/rs/rs.c
@@ -257,9 +257,11 @@ prepfile()
}
else if (orows == 0 && ocols == 0) { /* decide rows and cols */
ocols = owidth / colw;
- if (ocols == 0)
+ if (ocols == 0) {
warnx("display width %d is less than column width %d",
owidth, colw);
+ ocols = 1;
+ }
if (ocols > nelem)
ocols = nelem;
orows = nelem / ocols + (nelem % ocols ? 1 : 0);
OpenPOWER on IntegriCloud