summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2006-08-07 18:20:57 +0000
committermiod <miod@openbsd.org>2006-08-07 18:20:57 +0000
commitcc8b5a717a5254e738bcda8d07fdbb878f9bb65d (patch)
tree6244c538d7f9b6cac5b582ab7991b5bd2d8aca10
parentsmall whitespace nit (diff)
downloadwireguard-openbsd-cc8b5a717a5254e738bcda8d07fdbb878f9bb65d.tar.xz
wireguard-openbsd-cc8b5a717a5254e738bcda8d07fdbb878f9bb65d.zip
Avoid divide by zero in visual effects; spotted by Tobias Stoeckmann.
-rw-r--r--usr.sbin/fdformat/fdformat.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/fdformat/fdformat.c b/usr.sbin/fdformat/fdformat.c
index 748b21d4a39..26ca05ebee2 100644
--- a/usr.sbin/fdformat/fdformat.c
+++ b/usr.sbin/fdformat/fdformat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdformat.c,v 1.14 2006/04/02 00:50:42 deraadt Exp $ */
+/* $OpenBSD: fdformat.c,v 1.15 2006/08/07 18:20:57 miod Exp $ */
/*
* Copyright (C) 1992-1994 by Joerg Wunsch, Dresden
@@ -281,6 +281,8 @@ main(int argc, char *argv[])
bytes_per_track = fdt.sectrac * (1<<fdt.secsize) * 128;
tracks_per_dot = fdt.tracks * fdt.heads / 40;
+ if (tracks_per_dot == 0)
+ tracks_per_dot++;
if (verify_only) {
if (!quiet)